您的位置:首页 > 博客中心 > 数据库 >

SQL server中使用临时表存储数据

时间:2022-03-13 22:52

将查询出来的数据直接用“INTO #临时表名称”的方式完成临时表的创建及数据的插入

gxlsystem.com,布布扣

SELECT * INTO #temp_NowStatus
FROM Test

SELECT * FROM #temp_NowStatus --查询临时表中的数据
truncate table #temp_NowStatus --清除临时表中的数据
--删除临时表
if object_id(‘tempdb..#temp_NowStatus‘) is not null BEGIN
drop table #temp_NowStatus
END

SQL server中使用临时表存储数据,布布扣,bubuko.com

热门排行

今日推荐

热门手游