Alternatives to cursors in T-SQL

  • I have read "Down with cursors"  Fine, but these individuals that have supported this are suggesting any alternatives.  How about some suggestions?

    In Sybae I have bebome very used to the FOR Loop, but it does not have the same functionallity in T-SQL

    Takauma

  • The alternative to a cursor in tsql is to use a set based method to get the work done.  It's not always possible, but usually is.

    Other alternatives are to use other looping constructs, such as WHILE, but that's not any better than a cursor.  the issue with cursors is not cursors themselves, but they they are RBAR (row by agonizing row - phrase is Jeff Moden's) methods.  a WHILE loop, or any other looping construct, will have the same poor perf as a cursor.

     

    ---------------------------------------
    elsasoft.org

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

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