USE master
--检查是否已经存在一个表,如果有就删除
IF(EXISTS(SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = '#New_Table'))
DROP table #New_Table
GO
--创建临时表
CREATE TABLE #New_Table
(
ID int not null identity(1,1) primary key,
Name nvarchar(50) not null,
Age int not null
)
--向表中插入数据
INSERT INTO
#New_Table (Name,Age)
VALUES
('Lincoln',49),
('Zakary Zhou',25)
--更新表
UPDATE #New_Table
SET Age = 27
WHERE ID = 1
SELECT * FROM #New_Table