From: Roy Goldhammer on
hello there

I have dinamic sql which do SELECT * from dinamic table.

Is there a way not only doing select but insert some fields form that select
to table? according to Books online OUTPUT does not allow this.


From: Simon Whale on
Depends on your version of SQL. OUTPUT is a function that is available in
version 2005 onwards.

Kind Regards
Simon Whale

"Roy Goldhammer" <roy(a)top.com> wrote in message
news:OmPPYTsYKHA.4012(a)TK2MSFTNGP04.phx.gbl...
> hello there
>
> I have dinamic sql which do SELECT * from dinamic table.
>
> Is there a way not only doing select but insert some fields form that
> select to table? according to Books online OUTPUT does not allow this.
>


From: Uri Dimant on
Roy
CREATE TABLE tmp (c INT)

INSERT INTO tmp SELECT 1

EXEC ('SELECT * FROM tmp GO INSERT INTO tmp SELECT 2')

SELECT * FROM tmp

DROP TABLE tmp



"Roy Goldhammer" <roy(a)top.com> wrote in message
news:OmPPYTsYKHA.4012(a)TK2MSFTNGP04.phx.gbl...
> hello there
>
> I have dinamic sql which do SELECT * from dinamic table.
>
> Is there a way not only doing select but insert some fields form that
> select to table? according to Books online OUTPUT does not allow this.
>