cursor problem

  • SQLGuy64

    Ten Centuries

    Points: 1051

    Trying cursors out for the first time.  I know do it a different way; however this is a one off tool that will never be used again and using a cursor mimicks the logic of the application this tool needs to fix.

    I have two cursors in a script.  The first cursor executes and the second does not. The logic in psuedo code goes like this:

    create global temp table 1

    fill table

    create global temp table 2

    fill table

    add columns to global temp 2

    declare cursor 1

    run cursor 1 against global temp 2 and fill added columns

    close and deallocate cursor

    add column to global temp 2

    declare cursor 2

    run cursor 2 against global temp 2 and fill added column

    close and deallocate cursor

    thanx, for your time and attention

    andy

  • Gail Shaw

    SSC Guru

    Points: 1004474

    The pseudocode looks OK at a quick glance. Can you post the actual code? Would be easier to debug.

    Why global temp tables?

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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