八、SQLSERVER创建临时表
SQLSERVER创建临时表
示例:
DECLARE @TempTable TABLE([ID] INT) INSERT INTO @TempTable ([ID]) SELECT [ID] FROM T-SQL
删除示例:
--创建临时表 DECLARE @TempTable TABLE(Id INT) --给临时表插入数据 INSERT INTO @TempTable (Id) SELECT [ID] FROM fn_ConvertStringToTable(@Ids, ',') A --根据临时表删除数据 DELETE dbo.Table FROM @TempTable A WHERE A.Id = dbo.Table.Id