Forum Replies Created

Viewing 15 posts - 676 through 690 (of 897 total)

  • RE: CTE - How to surpass the limit

    Quatrei.X (8/26/2010)


    hmmmm...

    :hehe: I was planning to create a generic function which gets a comma separated list of words in a string and use CTE to seperate those strings to table...

  • RE: CTE - How to surpass the limit

    Yes. You can surpass the limit by setting the value for MAXRECURSION as 0.

    OPTION (MAXRECURSION 0)

    But always make sure you don't go into an infinite loop by using this option.

  • RE: Replace Not in subquery with a self join

    Try using NOT EXISTS. It might reduce the Number Of Reads.

    DELETE

    FROM RPF RO WITH (ROWLOCK)

    WHERE RO.U_S = 'PPP'

    AND RO.e_d = '20100811'

    AND NOT EXISTS ( SELECT * FROM RPF RI WITH...

  • RE: CTE with Order by and CASE

    One alternative could be this

    ;WITH MyCte AS

    (

    SELECTROW_NUMBER() OVER( ORDER BY CASE

    WHEN @sortOrder = 1 THEN CapId

    WHEN @sortOrder = 2 AND Area < 2000 THEN 3 -- Say 3 for Small

    WHEN...

  • RE: tsql retrieve records on date

    Jeff Moden (8/23/2010)


    Kingston Dhasian (8/23/2010)


    But i mostly use this method to write a quick query. It is short and sweet.

    ... and slow. Heh... I normally want the highest speed...

  • RE: tsql retrieve records on date

    Jeff Moden (8/22/2010)


    Kingston Dhasian (8/22/2010)


    One more solution to your problem

    SELECT * FROM holidays WHERE DATEDIFF( DAY, freedate, GETDATE() ) = 0

    The below mentioned article might be helpful to you

    http://www.sqlservercentral.com/articles/T-SQL/65806/

    Ummm... no....

  • RE: tsql retrieve records on date

    One more solution to your problem

    SELECT * FROM holidays WHERE DATEDIFF( DAY, freedate, GETDATE() ) = 0

    The below mentioned article might be helpful to you

    http://www.sqlservercentral.com/articles/T-SQL/65806/

  • RE: how to find max amount

    varshini (8/19/2010)


    can you expline me how to use the simple query to achive this ?

    If people start giving you the solutions directly you will not learn. Wayne has given you...

  • RE: need help

    Can't think of an easy solution for this. Lets see if somebody comes up with a quick solution. I will try it myself in my free time.

  • RE: need help

    This is enough to give you the required answer. No need of UNION with the other statement.

    SELECT EmpID, MIN(startdate),MAX(ISNULL(enddate,Getdate())) As EndDate FROM Duration

    group by EmpId

  • RE: Statement Where clause errors

    To see the execution plan, you can select the option Query -> Include Actual Execution Plan. Now if you run the SELECT query you will see the Execution Plan after...

  • RE: Statement Where clause errors

    If you see the Execution Plan for the query, the picture will be clear. The WHERE Clause is actually evaluated before your SELECT Clause and the ORDER BY Clause. Hence...

  • RE: How to break string and insert each substring

    The link below will be helpful for these type of problems

    http://www.sqlservercentral.com/articles/T-SQL/63003/

  • RE: join on tables

    You can use a ROW_NUMBER() for the same. Have a look at it in Books Online.

    SELECTa_id, expense, b_id, CASE WHEN RowNum = 1 THEN amount ELSE 0 END amount

    FROM(

    SELECTROW_NUMBER() OVER(...

  • RE: ORDER Result

    You can do it like this

    SELECTScheduledTime

    FROMSchedule

    ORDER BY CASE ScheduledTime

    WHEN 'Morning' THEN 1

    WHEN 'Afternoon' THEN 2

    WHEN 'Evening' THEN 3

    END

Viewing 15 posts - 676 through 690 (of 897 total)