SQL Server 表变量和临时表

发布时间:2017-06-25 00:04:17 编辑:站点网
INSERT INTO #tb_table(ProductName, Length, Windth, Height) VALUES('B', 0.4, 0.5, 0.6); INSERT INTO #tb_table(ProductName, Length, Windth, Height) VALUES('C', 0.7, 0.8, 0.9); IF OBJECT_ID('tempdb..##tb_table','U') IS NOT NULL DROP TABLE ##tb_table GO SELECT * INTO ##tb_table FROM #tb_table; UPDATE A SET Length = 2.5 FROM #tb_table AS A WHERE RowID = 1 ; DELETE TOP(1) A FROM #tb_table AS A WHERE RowID = 2; SELECT * FROM #tb_table; SELECT * FROM ##tb_table

执行上面的局部临时表和全局临时表创建语句之后,我们在SSMS中新开启一个连接,执行下面的语句:

SELECT * FROM ##tb_table GO  SELECT * FROM #tb_table 

返回执行结果如下:

更多相关内容:
    无相关信息
[!--temp.cy--]