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,890
  • 4
  • 31
  • 50
Shawn
  • 2,307
  • 4
  • 47
  • 79
  • 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
  • 16,801
  • 2
  • 33
  • 54
0

How about this?

INSERT INTO testTable SELECT ID, ID2 from @t
Sergio
  • 6,870
  • 5
  • 29
  • 54