Click here to Skip to main content
14,447,105 members
Rate this:
Please Sign up or sign in to 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 4: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

Rate this:
Please Sign up or sign in to vote.

Solution 1

Hi,

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

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
   

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




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100