Friday, March 30, 2012

Saving Store procedure on table

Hello there
I have some store procedure that return query as result.
Is there a way to store the result in table?"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:em9Zi27CGHA.2956@.TK2MSFTNGP14.phx.gbl...
> Hello there
> I have some store procedure that return query as result.
> Is there a way to store the result in table?
Maybe this will give you the information you need:
http://www.sommarskog.se/share_data.html|||INSERT INTO YourTable (Col1, Col2...) EXEC YourSp
Andrew J. Kelly SQL MVP
"Roy Goldhammer" <roy@.hotmail.com> wrote in message
news:em9Zi27CGHA.2956@.TK2MSFTNGP14.phx.gbl...
> Hello there
> I have some store procedure that return query as result.
> Is there a way to store the result in table?
>
>|||You can create the table upfront & use INSERT .. EXEC statement.
INSERT tbl ( ... ) EXEC usp @.param1, @.param2, ...
Alternatively, you can create a loopback and use OPENQUERY like:
EXEC sp_serveroption 'data access', true
GO
SELECT * INTO tbl
FROM OPENQUERY ( Server, 'SET FMTONLY OFF; EXEC.. ' )
Anith

No comments:

Post a Comment