sql临时表建立和使用

sql临时表建立和使用


SET STATISTICS TIME ON --开启时间信息
drop table #temp  --删除已存在临时表(断开连接时自动删除)
select * into #temp from orders order by orderdate  --建立临时表
select * from #temp  --查询临时表

#table  是在当前数据库中
##table  是在全局的数据库中
跨库使用格式:  数据库名.dbo.表名

posted on 2010-10-23 01:07  血吸虫  阅读(432)  评论(0编辑  收藏  举报

导航