Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Dear Experts,

I have a doubt in MSSQL Query. ..


I have two Stored Procedure. First one is "A" and Second one is "B"

When i Execute the stored procedure "A" then it retrieves 3 Tables.

And the stored procedure "B" need to execute the first Stored procedure within the stored procedure "B". And insert the second table into a temporary table.

How can i do it. please help me..


Thanks,

Dileep...
Posted
Updated 2-Jul-15 3:04am
v2
Comments
virusstorm 2-Jul-15 10:35am    
Are you trying to pass a temporary table into a stored procedure?
Suvendu Shekhar Giri 2-Jul-15 16:12pm    
A sample of input and output can make it little more clear. Please do it.

1 solution

Hi,

You can insert result of a stored procedure to temp table using below way:

SQL
Insert into #Temp
(
    Col1,
    Col2,
    Col3
)
Exec A


Please make sure to have matched number of columns in stored procedure result and columns which are there inside insert statement.

If you execute on the above way and if stored procedure "A" will return 3 tables then it will combine result of all the 3 tables.

I am not sure is it possible to insert only second table of the result. I think it is not possible.

Please let me know if you have any concern or query on this.

Thanks
Advay Pandya
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900