Insert Exec cannot be nested
Posted on 2013-01-23
I had the following statement in my stored procedure
INSERT INTO #nextMtg EXECUTE proc_nextMtgList @estID,'', 0
I got the error 'Insert Exec cannot be nested...' and I realised there is another INSERT INTO..EXECUTE stmt in the same store procedure. So I changed my line of code to
INSERT INTO #upcomMtg
Select * from openrowset('SQLOLEDB','Server=<instance\servername>;UID=<uid>;PWD=<pwd>;database=<dbname>;Trusted_Connection=yes;','EXEC <dbname>.dbo.proc_nextMtgList 526,'''', 0') AS a
Now I am getting the error 'Invalid object name #rvmyMtg'
#rvmyMtg is a temp table created in the stored procedure proc_nextMtgList.
The stored procedure proc_nextMtgList is working correctly by itself. What could be causing the invalid object error?