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

Posted on 2006-03-22
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.
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.

Question by:sabrina_spillane
    1 Comment
    LVL 12

    Accepted Solution

    -- 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


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
    The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
    Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
    Viewers will learn how the fundamental information of how to create a table.

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now