is it possible to replace While loop by cte ?

  • HI Folks,

    Is it possible to replace while loop by CTE?

    I will fetch records from table 1 based on tretmentid.

    get the count of records

    run the while loop

    inside loop i will compare the column values with the same table(table 1) for different tretmentid.

    if any one row matches will come out from loop and send status .

    can it be replaced by CTE ?

    Regards,

    Ravi

  • ravi@sql (8/11/2015)


    HI Folks,

    Is it possible to replace while loop by CTE?

    I will fetch records from table 1 based on tretmentid.

    get the count of records

    run the while loop

    inside loop i will compare the column values with the same table(table 1) for different tretmentid.

    if any one row matches will come out from loop and send status .

    can it be replaced by CTE ?

    Regards,

    Ravi

    Maybe. But without seeing your code, can't say for sure.

    By the way, a CTE is just a glorified subquery, nothing more.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply