4
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?

Vinay
  • 6,891
  • 4
  • 32
  • 50
Shawn
  • 2,356
  • 6
  • 48
  • 82
  • Just think of it as a normal table, you can do the usual `INSERT INTO ... SELECT ...` syntax. – Bridge Feb 08 '13 at 13:46

2 Answers2

9

This is how you should do that:

INSERT INTO testTable (Id, Id2)
SELECT ID, ID2 
from @t
gzaxx
  • 17,312
  • 2
  • 36
  • 54
0

How about this?

INSERT INTO testTable SELECT ID, ID2 from @t
Sergio
  • 6,900
  • 5
  • 31
  • 55