I have the following scenario.
SP1 - uses linked server and openquery to access data from our AS400. I'm using several selections and putting results into temp tables, combining temp tables and Outputting results at the end of the SP to display on my ASP.Net Page. This is working great.
I now want to reuse the code SP2. Basically I want to call SP1 from SP2 and get the results into a temp table that I can process. So this is the code I'm using...
INSERT INTO #tmpRecords
I am getting the following error...
An INSERT EXEC statement cannot be nested
I see this is an error I can't do much about, but is there some sort of a workaround for me so I do not have to have my logic inside of SP2 as well?