Showing posts with label returnedfrom. Show all posts
Showing posts with label returnedfrom. Show all posts

Monday, March 26, 2012

opening cursor on result set from stored proc

In SQL how can a cursor be opened to iterate the result set returned
from a stored proc

-Rahul Sood
rsood22@.yahoo.comYou can insert the procedure result set into a table. For example:

CREATE TABLE #ProcResults
(
SomeData int
)

INSERT INTO #ProcResults
EXEC MyProcedure

DECLARE MyCursor CURSOR
LOCAL FAST_FORWARD READ_ONLY FOR
SELECT * FROM #ProcResults

--
Hope this helps.

Dan Guzman
SQL Server MVP

--------
SQL FAQ links (courtesy Neil Pike):

http://www.ntfaq.com/Articles/Index...epartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--------

"Rahul Sood" <rsood22@.yahoo.com> wrote in message
news:aa3020f6.0308191503.68af9ec5@.posting.google.c om...
> In SQL how can a cursor be opened to iterate the result set returned
> from a stored proc
> -Rahul Sood
> rsood22@.yahoo.comsql