Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Store the stored procedure result in a temp. tabl

Author  Topic 

sqlilliterate
Starting Member

40 Posts

Posted - 2008-03-28 : 01:04:17
All,

I'm trying to store the results of my store procedure in a temp table. when I try it, I got the error saying...

"Insert exec cannot be nested"

I suspsect this is because I have a Insert Exec statement inside my stored procedure...

Is there any way to come over this issue ?

syntax of my code...

create table #Temp1 (ID int)

insert into #Temp1
EXEC SP1

when I try to run the above code I get the error "Insert exec cannot be nested"

SP syntax :

Create Procedure SP1
as
Begin
create table #Temp2
statements.....

Insert into #temp2
exec SP<Name>

staments.. cont...
END

ayamas
Aged Yak Warrior

552 Posts

Posted - 2008-03-28 : 02:03:32
Maybe this might help you.

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=346345&SiteID=1
Go to Top of Page
   

- Advertisement -