Posted by: codeproject | August 31, 2007

SQL SERVER 2005- How to call nested stored procedure and save the output in Temporary Table

Well, I have to create a procedure which calls nested procedures to reduce the work again and store the output of the nested stored procedure in the temporary table.
Here are the few steps taken by me to achieve this task
Suppose you have stored procedure named sp_FirstProcedure and sp_SecondProcedure

As I have move my blog from here please visit for detail.

http://blog.joggee.com/?p=24

for future reference

http://blog.joggee.com

sorry for any inconvenience

Rana


Responses

  1. isnt there supposed to be a way of creating and inserting into a temp table in one step?

  2. Yes, you can create and insert values in temp table but using select query not stored procedure.

    i.e.

    Select * into #temp from Table

    You can also insert the values into temp table from Stored Procedure but Temp table should created before.

    i.e.
    Insert into #tempCityEmp Exec sp_First

    Hope this is your answer.

    If not please eloborate in detail what exactly you are asking and what is the benefit to do this in one line and why ?

    Thank you very much for your comments.

    regards,

    Rana

  3. you did not give proper syntax
    actually i want to save the data retrived from [sp_help table_name] in to a temporary table pls reply me fast

  4. create @temp_table table (all fields)
    Insert into @temp_table
    EXECUTE Sp_Travel_RaReturn_Table @detail,’|',’,’

    here
    Sp_Travel_RaReturn_Table is storeprocedure for returning values in table format.
    Upper statement is not working in my store procedure. Even same statement is working in another storeprocedure.. All details are same in both storeprodecure
    –Chetan Patel

  5. Select * into #temp from Table

    will avobe works in sql server? I have little doubt on it. If so please let me know will help me a lot.

    thanks
    Deb


Leave a response

Your response:

Categories