2012年6月25日
摘要: 个人觉得,sqlserver在2005以后推出窗口函数 Over完全是一个创举,他让很多的复杂的问题变得简单了。既然是用法,我就不说明其他的东西,举一些例子就好了:create table OverTableTest ( id int identity(1,1),--ID Val int, --值 typ int, --类型 ) go declare @cou int set @cou=1 while @cou<50 begin insert into OverTableTest select @cou,@cou%5+1 set @cou=@cou+1 end go s... 阅读全文
posted @ 2012-06-25 14:47 叮叮猫的编程世界 阅读(665) 评论(0) 推荐(0)
摘要: SELECT TOP 50 total_worker_time/1000 AS [总消耗CPU 时间(ms)],execution_count [运行次数], qs.total_worker_time/qs.execution_count/1000. as [平均消耗CPU 时间(ms)], SUBSTRING(qt.text,qs.statement_start_offset/2+1, (case when qs.statement_end_offset = -1 then DATALENGTH(qt.text) else qs.statement_end_offse... 阅读全文
posted @ 2012-06-25 09:46 叮叮猫的编程世界 阅读(229) 评论(0) 推荐(0)
摘要: SELECT t1.session_id, (t1.internal_objects_alloc_page_count + t1.user_objects_alloc_page_count + task_alloc) as [保留或配置的总数据页数], (t1.internal_objects_dealloc_page_count + t1.user_objects_dealloc_page_count + task_dealloc) as [取消配置的总数据页数] from sys.dm_db_session_space_usage as t1, (select session_id,... 阅读全文
posted @ 2012-06-25 01:45 叮叮猫的编程世界 阅读(311) 评论(0) 推荐(0)