Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Archiving Data

Author  Topic 

Lorna70
Starting Member

19 Posts

Posted - 2010-05-31 : 10:04:33
Is there a way of executing a stored procedure to display records and then save those records into a new table without having to have created the table beforehand? I found a way of doing all this in one sproc but that method involved specifying all the columns for the new table - surely there is a quicker method than that?

Transact Charlie
Master Smack Fu Yak Hacker

3451 Posts

Posted - 2010-05-31 : 11:02:42
You can use openrowset I believe.

http://msdn.microsoft.com/en-us/library/ms190312.aspx

And a guide is here:
http://www.sommarskog.se/share_data.html


Charlie
===============================================================
Msg 3903, Level 16, State 1, Line 1736
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-06-01 : 02:14:15
Also refer method 2
http://beyondrelational.com/blogs/madhivanan/archive/2007/11/24/select-columns-from-exec-procedure-name-is-this-possible.aspx

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -