?
Solved

SQL Sever 2000 - How do I create a Cursor that returns data and stores it in a table

Posted on 2006-03-22
1
Medium Priority
?
217 Views
Last Modified: 2010-03-19
I am working with SQL Sever 2000 and I am trying to create a cursor that will run another stored procedure and return its resutls and store those resutls in a temp table.
CREATE cur_name CURSOR
FOR exec SP_runstored procedure
OPEN cur_name
then insert the results into a temp table #temptest which i have created?
Has anyone go any ideas on this. Thanks for all the helo in advance.

0
Comment
Question by:sabrina_spillane
1 Comment
 
LVL 12

Accepted Solution

by:
ill earned 750 total points
ID: 16258513
-- standard way of doing it, is inserting the resultset directly into #temp table. cursor is not necessary.
create table #temptest (...)
insert into #temptest exec SP_runstored_procedure

0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question