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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Hi All Can you DECLARE a cursor

Status
Not open for further replies.

LokiDba

Programmer
Joined
Dec 13, 2000
Messages
63
Location
GB
Hi All

Can you DECLARE a cursor so that it uses a stored procedure ie you are fetching throught the resultset of the stored procedure. This is in SQLServer 7

Thanks in advance

LokiDBA
 

You cannot delare a cursor that fetches the output of a stored procedure directly as in

Declare MyCursor Cursor For
Exec MyProc

However, you can insert the output of the stored procedure into a temporary table and then select from the temp table into the cursor.

Insert #temp
exec MyProc

declare mycursor cursor for
Select * From #temp Terry L. Broadbent
FAQ183-874 contains tips for posting questions in these forums.
NOTE: Reference to the FAQ is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top