判断sql执行效率以及针对临时表的使用

/****** Script for SelectTopNRows command from SSMS  ******/

  
  
SET STATISTICS io ON
SET STATISTICS time ON
go
SELECT * FROM [TestPrint] WHERE ID IN (1,2,3,4,5,6,7,8,9,10);
go
SET STATISTICS profile OFF
SET STATISTICS io OFF
SET STATISTICS time OFF
go

SET STATISTICS io ON
SET STATISTICS time ON
go
SELECT * FROM [TestPrint] WHERE ID BETWEEN '1' AND '10';
go
SET STATISTICS profile OFF
SET STATISTICS io OFF
SET STATISTICS time OFF
go

select * into #tab from [TestPrint] where ID between '1' and '50000';
select * from #tab order by ID asc;
select name from tempdb.dbo.sysobjects where type='u' and name like '#%'
--truncate table ;(删除表)
go

  

posted @ 2015-04-08 17:11  临冰听雪丶  阅读(163)  评论(0编辑  收藏  举报