0

I have one stored procedure. I don't know the data type of the result set. I want to avoid prior declaration of table schema.

Now, I want to store the result set of procedure in a temporary table. In pseudo SQL it would look like this:

select * into #table1 exec proc_name

What would be the real SQL to do it?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Gopal
  • 57
  • 6

1 Answers1

0

Step 1: Create a temp tables. Say #temp Step 2:

INSERT INTO #temp
exec proc_name
Ritesh kumar
  • 278
  • 1
  • 3
  • I will create the temp table based on the output of procedure.In that case temp table will be tighty coupled with result set of proc, which I dont want..Is there any other way? – Gopal Sep 19 '13 at 05:15