Wednesday, March 7, 2012

How to stored a stored procedures results into a table

Hi, How can I store a stored procedure's results(returning dataset) into
a table?

Bob

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!"Bob James" <BJ@.system.com> wrote in message news:41ed4eb1$1_2@.127.0.0.1...
> Hi, How can I store a stored procedure's results(returning dataset) into
> a table?
> Bob
>
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

insert into dbo.MyTable
exec dbo.MyProc @.parm1 = 'foo'

Where dbo.MyTable already exists and matches the structure (columns and data
types) of the procedure's result set. But there are a number of issues with
this approach:

http://www.sommarskog.se/share_data.html#INSERTEXEC

If you read the whole article you might find one of the other approaches
suits your needs better anyway, so you can avoid those issues.

Simon

No comments:

Post a Comment