Thursday, March 22, 2012

Creating a table by executing a storedproc

It is possible to create a table by executing a storedproc, similar to using
the SELECT...INTO...FROM TABLE but replacing the FROM TABLE clause by the
execution a a storedproc.
thanks in advanceIt is not possible.
You may have to create the table and then yo can use an EXEC Sproc to
populate it with the Result Set.
You may use Base Table or a # Table to populate but not the @.Table.
HTH
Satish Balusa
Corillian Corp.
"Benoit Drapeau" <review@.videotron.ca> wrote in message
news:ej1mS1P5DHA.2168@.TK2MSFTNGP12.phx.gbl...
quote:

> It is possible to create a table by executing a storedproc, similar to

using
quote:

> the SELECT...INTO...FROM TABLE but replacing the FROM TABLE clause by the
> execution a a storedproc.
> thanks in advance
>
|||It's possible by creating table first covering all the columns displayed by
the sotred procedure:
create table test (col1, col2, col3...)
insert into table exec ('stored proc')
richard
"Benoit Drapeau" <review@.videotron.ca> wrote in message
news:ej1mS1P5DHA.2168@.TK2MSFTNGP12.phx.gbl...
quote:

> It is possible to create a table by executing a storedproc, similar to

using
quote:

> the SELECT...INTO...FROM TABLE but replacing the FROM TABLE clause by the
> execution a a storedproc.
> thanks in advance
>
|||A workaround is to use OPENROWSET or OPENQUERY:
SELECT * INTO #tmp
FROM OPENROWSET('SQLOLEDB', 'machine';'login';'pwd', 'EXEC sp_help')
SELECT * FROM #tmp
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=...ls
erver
"Benoit Drapeau" <review@.videotron.ca> wrote in message
news:ej1mS1P5DHA.2168@.TK2MSFTNGP12.phx.gbl...
quote:

> It is possible to create a table by executing a storedproc, similar to usi
ng
> the SELECT...INTO...FROM TABLE but replacing the FROM TABLE clause by the
> execution a a storedproc.
> thanks in advance
>
|||Thanks, this is exactly wat I was looking for.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:O9U1m#Y5DHA.2392@.TK2MSFTNGP11.phx.gbl...
quote:

> A workaround is to use OPENROWSET or OPENQUERY:
> SELECT * INTO #tmp
> FROM OPENROWSET('SQLOLEDB', 'machine';'login';'pwd', 'EXEC sp_help')
> SELECT * FROM #tmp
>
> --
> Tibor Karaszi, SQL Server MVP
> Archive at:

http://groups.google.com/groups?oi=...ublic.sqlserver
quote:

>
> "Benoit Drapeau" <review@.videotron.ca> wrote in message
> news:ej1mS1P5DHA.2168@.TK2MSFTNGP12.phx.gbl...
using[QUOTE]
the[QUOTE]
>

No comments:

Post a Comment