码迷,mamicode.com
首页 > 数据库 > 详细

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

时间:2014-08-18 20:24:02      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:blog   http   使用   数据   2014   log   sql   table   

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

bubuko.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

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

标签:blog   http   使用   数据   2014   log   sql   table   

原文地址:http://www.cnblogs.com/stevenjson/p/3920312.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!