Forum Replies Created

Viewing 15 posts - 751 through 765 (of 1,114 total)

  • RE: Fight against SET BASED and CURSOR

    Jason,

    Its working perfectly. Thanks a lot.:)

    Really your help is very much useful for me. So once again My hearty thanks to you.:)

  • RE: Fight against SET BASED and CURSOR

    Jason,

    I will check it and come back to you.:)

  • RE: Fight against SET BASED and CURSOR

    Jason,

    Thanks a lot for your prompt reply.

    Sure. I am using sql2000. I think your query will work in sql2005 only.

    Once again my hearty thanks to you.

  • RE: Find Last Day of Month

    Jeff,

    Thanks a lot for your help!

    I have purified one more time.

    DECLARE @DateStart DATETIME

    DECLARE @DateEnd DATETIME

    SELECT @DateStart = '07/Apr/2008', @DateEnd = '29/Dec/2008'

    SELECT Month = convert(varchar,DatePart(MM,DATEADD(mm,N-1,@DateStart))),

    ...

  • RE: Find Last Day of Month

    Jeff,

    I have refined the above code as

    DECLARE @DateStart DATETIME

    DECLARE @DateEnd DATETIME

    SELECT @DateStart = '04/Apr/2007', @DateEnd = '29/Apr/2008'

    SELECT convert(Datetime,'01'+'/'+convert(varchar,DatePart(MM,DATEADD(mm,N-1,@DateStart)))+'/'+convert(varchar,DatePart(YY,DATEADD(mm,N-1,@DateStart))),103),

    DateAdd(DD,-1,convert(Datetime,'01'+'/'+convert(varchar,DatePart(MM,DATEADD(mm,N,@DateStart)))+'/'+convert(varchar,DatePart(YY,DATEADD(mm,N,@DateStart))),103))

    FROM dbo.Tally

    where DateAdd(DD,-1,convert(Datetime,'01'+'/'+convert(varchar,DatePart(MM,DATEADD(mm,N,@DateStart)))+'/'+convert(varchar,DatePart(YY,DATEADD(mm,N,@DateStart))),103)) <= @DateEnd

    I got the below output:

    Apr ...

  • RE: Find Last Day of Month

    Jeff,

    DECLARE @DateStart DATETIME

    DECLARE @DateEnd DATETIME

    SELECT @DateStart = '04/Apr/2007', @DateEnd = '29/Apr/2008'

    SELECT convert(Datetime,'01'+'/'+convert(varchar,DatePart(MM,DATEADD(mm,N-1,@DateStart)))+'/'+convert(varchar,DatePart(YY,DATEADD(mm,N-1,@DateStart))),103),

    DateAdd(DD,-1,convert(Datetime,'01'+'/'+convert(varchar,DatePart(MM,DATEADD(mm,N,@DateStart)))+'/'+convert(varchar,DatePart(YY,DATEADD(mm,N,@DateStart))),103))

    FROM dbo.Tally

    Above code is working fine. But it is running like a car without break:). Yes,It...

  • RE: Find Last Day of Month

    i have executed the below statements.

    select dateadd(mm,0,0)

    select dateadd(mm,0,-1)

    I got the following error.

    Function DATEADD invoked with wrong number or type of argument(s).

    select datediff (yy, "1984", 0)

    Function DATEDIFF invoked with wrong number...

  • RE: Fight against SET BASED and CURSOR

    Jason,

    I want to generate the last date for each month.

    Select @year = min(Year)

    From PRREQ

    ...

  • RE: Find Last Day of Month

    Jeff,

    It is not working. I got the below error message.

    Function DATEDIFF invoked with wrong number or type of argument(s).

    But when i execute it seperately like

    select DATEDIFF(MM,'01/apr/2007','01/apr/2008')

    its showing 12.

    Please help...

  • RE: TSQL - Conditional Check

    First off, if @abc is varchar, then -1 isn't a valid value, although '-1' is.

    Just i tried to ask explanation for the above one.

  • RE: TSQL - Conditional Check

    First off, if @abc is varchar, then -1 isn't a valid value, although '-1' is.

    I do agree with you. I made mistake.

    User will pass a value for @abc,Say forexample @abc...

  • RE: TSQL - Conditional Check

    Karthik

    What is the data type of @abc?

    John

    @abc is Varchar.

    Jason,

    My requirement is:

    If @abc = '' or @abc = -1 then i want to assign NULL value to @abc.

  • RE: Merging Rows with comma

    SQL Server 2005 to use FOR XML PATH('').

    But i am using sql2000.

  • RE: Merging Rows with comma

    I am also thought to use WHILE LOOP.

    Adrian, do you think is there any performance wise difference between using CURSOR and WHILE loop ?

    Please share your thoughts.

  • RE: Merging Rows with comma

    How many rows does this table have?

    50000 rows.

    Hom many rows are there maximum (if there is a maximum) does each employee have?

    10-15

Viewing 15 posts - 751 through 765 (of 1,114 total)