Forum Replies Created

Viewing 15 posts - 181 through 195 (of 479 total)

  • RE: How can i split my input variable string and compare?

    There are probably better ways...

    [font="Courier New"]

    DECLARE @temp VARCHAR(30)

    SET @temp = 'Pravin,Mit,Sid'

    DECLARE @rest VARCHAR(30)

    DECLARE @table_var TABLE (name VARCHAR(30))

    SET @rest=@temp

    WHILE PATINDEX('%,%',@rest) <> 0

    BEGIN

       INSERT @table_var VALUES(LTRIM(RTRIM(SUBSTRING(@rest,1,PATINDEX('%,%',@rest)-1))))

       SET @rest = SUBSTRING(@rest,PATINDEX('%,%',@rest)+1,LEN(@rest))

    END

    INSERT @table_var VALUES(LTRIM(RTRIM(@rest)))

    SELECT...

  • RE: T-SQL

    I got the same wrong (but right) answer as everyone else (Option 4 only), but learned something while testing the result.

    select '2009-02-01 00:00:00:000' union

    select '2009-01-31 23:59:59:999'Produces 2 rows.

    select convert(datetime,'2009-02-01 00:00:00:000')...

  • RE: Dynamically creating sql server job using SP and kicking off the job

    Ramesh (2/17/2009)


    Taken from Books Online:

    ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/udb9/html/3b76545e-ad7d-4a05-8766-272546aeed2e.htm

    How to: Create a SQL Server Agent Job (Transact-SQL)

    This topic describes how to use stored procedures to create a Microsoft SQL Server Agent job.

    To create...

  • RE: Best way to calculate duration from 1 table?

    If you can guarantee that each 'Running' state has a matching 'Success' or 'Error' (i.e. you never get consecutive 'Running' state) you could tryDROP TABLE #Table

    CREATE TABLE #Table (ObjectID INT,...

  • RE: Are the posted questions getting worse?

    Jeff Moden (2/16/2009)


    Derek Dongray (2/16/2009)


    bitbucket (2/13/2009)


    shhh tell no one, but heck it was better than using a slide rule to do the calculations.

    I still have my slide rule and can...

  • RE: Happy President's Day 2009

    That make UK holidays seem generous.

    My package, which I don't think is unusual, is to get 25 days off per year plus 8 public holidays (New Year, Good Friday, Easter...

  • RE: Aviod loading the files in SSIS

    If you are willing to use a (free) 3rd party tool, Konesans' File Watcher Task sounds like it does exactly what you want.

    NB: I haven't use this particular tool myself...

  • RE: Insert Statement taking too long

    Leo (2/14/2009)


    INSERT INTO Employee(Name, CardNo)

    SELECT (Name, CardNo)

    From Emp_Detail T

    LEFT JOIN Stuff_Detail I

    ON T.CardNo = I.CardNo COllate database_Default

    WHERE I.CardNo IS NULL

    This is an invalid query because:

    1....

  • RE: Insert Statement taking too long

    It's a LEFT JOIN.

    Unmatched records have NULLs in all the fields from the unmatched table. See http://msdn.microsoft.com/en-us/library/ms177634(SQL.90).aspx

  • RE: Are the posted questions getting worse?

    This isn't actually a bad question, but my thought when I read

    louisevb (2/16/2009)


    I have decided to change my career from accounting to Database Developer (BIG change . . BIG challenge),...

  • RE: GETDATE -1 Expression

    "Process completed successfully for " + (DT_STR,4,1252)[YEAR]([DATEADD]("d",-1,[GETDATE]())) + "-" +

    ("0" + (DT_STR,2,1252)[MONTH]([DATEADD]("d",-1,[GETDATE]())),2) + "-" +

    ("0" + (DT_STR,2,1252)[DAY]([DATEADD]("d",-1,[GETDATE]())),2)

  • RE: up to 3 rows in source table... needs flattening into 1 row in dest.

    How about...create table #t ([inc_id] int, player varchar(10))

    insert #t

    select 1, 'Ned' union all

    select 1, 'Bob' union all

    select 1, 'Steve' union all

    select 2, ...

  • RE: GETDATE -1 Expression

    Or DATEADD("d",-1,GETDATE())

    (I forgot that SSIS needs the quotes).

  • RE: GETDATE Exspression

    Derek Dongray (2/16/2009)


    How about using DATEADD(d,-1,GETDATE()) ?

    For SSIS, it's DATEADD("d",-1,GETDATE()).

    BTW, I tested this with a flat source file (with 1 line in it), a Derived Column Transform (with the OP's...

  • RE: GETDATE Exspression

    How about using DATEADD(d,-1,GETDATE()) ?

Viewing 15 posts - 181 through 195 (of 479 total)