Reputation: 189
I have stored procedure which returns multiple data sets and I need to create tables based on that data sets to get data types. Found this code
SELECT *
INTO newTable
FROM OPENROWSET ('SQLNCLI', 'Server=localhost;Trusted_Connection=yes;',
'EXEC ISS.dbo.sp')
but it works only for first result set and I need tables for all results
Upvotes: 1
Views: 133
Reputation: 5458
Once OpenTable is created you can do this over and over again:
Insert into OpenTable
Exec dbo.proc55
Upvotes: 0
Reputation: 2922
As far as I know, cleaner way of using stored procedure output to populate data to a table is a much required solution. There are many ways including the ones you have shown above, but every technique has its own plus and minus.
The solution I have used is create global temporary table
I don't know if it suits for our need.
Upvotes: 1