CODE:
USE Sales; GO /* CREATE TABLE Orders ( OrderID int IDENTITY(1,1) PRIMARY KEY, OrderGUI uniqueidentifier ROWGUIDCOL NOT NULL DEFAULT NEWID(), OrderDate datetime, Sendto varchar(40) ); INSERT INTO Orders(OrderDate, Sendto) VALUES ('2008-1-1','Jinan City, China'), ('2008-2-19','BeiJing City, China'); CREATE TABLE #MyTempTable(cola int PRIMARY KEY); INSERT INTO #MyTempTable VALUES(1); GO SELECT * FROM #MyTempTable; */ DECLARE @TableVar TABLE(Cola int PRIMARY KEY, Colb char(3)) INSERT INTO @TableVar VALUES(1, 'abc') INSERT INTO @TableVar VALUES(2, 'def') SELECT * FROM @TableVar
截图: