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!

What Data can I put into a Cursor? 1

Status
Not open for further replies.

cmdematos

IS-IT--Management
Mar 7, 2001
29
US
I can get the result of a select statement into a cursor...

declare cr cursor for select * from clients

but I cannot seem to get the result of another stored procedure into the cursor...

delcare cr cursor for exec sp_get_from_clients

Is there a way to achieve this?
 
You can't put the output of a SP into a cursor directly. One work around is to create a temporary table, insert output of the SP into the table, and create the cursor on the temp table.

Example:

Create Table #Temp (<column definitions>)

Insert #temp
Exec sp_get_from_clients

declare cr cursor for select * from #temp Terry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top