How to store stored proc results to a temp table
-
insert into #temp exec dbo.MyStoredProc 89,1 (MyStoredProc requires 2 integer parameters.) The above works fine but in my stored proc where I write this insert statement, I need to create the #temp table and MyStoredProc results in 100 columns. Only 5 columns have to be stored in #temp. I need something like below. (As you would know, am making it clear, below does not work!!) select col1,col2,col3,col4 into #temp exec dbo.MyStoredProc 89,1
------------------------------------------------------------ "The only true wisdom is in knowing you know nothing." --Socrates
-
insert into #temp exec dbo.MyStoredProc 89,1 (MyStoredProc requires 2 integer parameters.) The above works fine but in my stored proc where I write this insert statement, I need to create the #temp table and MyStoredProc results in 100 columns. Only 5 columns have to be stored in #temp. I need something like below. (As you would know, am making it clear, below does not work!!) select col1,col2,col3,col4 into #temp exec dbo.MyStoredProc 89,1
------------------------------------------------------------ "The only true wisdom is in knowing you know nothing." --Socrates
If i understand you well, you want to insert records into a Temp table and you expect to have atleast 100 records because the Source have atleast 100 records and what you get in that temp is 5recs?
Vuyiswa Maseko, Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding VB.NET/SQL7/2000/2005 http://vuyiswamb.007ihost.com http://Ecadre.007ihost.com vuyiswam@tshwane.gov.za