简体   繁体   中英

Insert into table from table variable?

DECLARE @t TABLE
(
ID uniqueidentifier,
ID2 uniqueidentifier
)

...insert into @t ...do stuff to @t

INSERT INTO testTable (Id, Id2) VALUES (SELECT ID, ID2 from @t) -does not work?

This is how you should do that:

INSERT INTO testTable (Id, Id2)
SELECT ID, ID2 
from @t

这个怎么样?

INSERT INTO testTable SELECT ID, ID2 from @t

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM