Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DECLARE CURSOR must be the only statement in a query batch

Status
Not open for further replies.

lazyrunner50

Programmer
Jul 30, 2004
63
0
0
US
I am using a cursor at the top of a *.sql file to loop through the records of a table, and am inserting these values into a temporary table which I am using within the loop. While I am within this loop, I move through the records in the table to try to match up the current value with the one from the outer table. Anyways, I am having a problem with this inner loop. I am trying to use a cursor to move through the table, but I keep getting the error "DECLARE CURSOR must be the only statement in a query batch". Does anyone know what this means, how to solve it, or how to avoid it entirely by not using a cursor?

Thanks in advance!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top