首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

搜集另类的sql语句集合解决方案

2012-01-02 
搜集另类的sql语句集合大家在学习sql当中有没有遇到什么好玩另类的语句,拿出来大家分享啊!要求能看到结果

搜集另类的sql语句集合
大家在学习sql当中有没有遇到什么好玩另类的语句,拿出来大家分享啊!
要求能看到结果的啊。自己先调试好再发上来。

[解决办法]
--总计耗费CPU时间最长的查询计划
SELECT TOP 5 total_worker_time, last_worker_time,
max_worker_time, min_worker_time,
SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,
((CASE statement_end_offset
WHEN -1 THEN DATALENGTH(st.text)
ELSE qs.statement_end_offset END
- qs.statement_start_offset)/2) + 1) as statement_text
FROM sys.dm_exec_query_stats as qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) as st
ORDER BY total_worker_time DESC
--
select * FROM sys.dm_exec_query_stats
----
sql_handle statement_start_offset statement_end_offset plan_generation_num plan_handle creation_time last_execution_time execution_count total_worker_time last_worker_time min_worker_time max_worker_time total_physical_reads last_physical_reads min_physical_reads max_physical_reads total_logical_writes last_logical_writes min_logical_writes max_logical_writes total_logical_reads last_logical_reads min_logical_reads max_logical_reads total_clr_time last_clr_time min_clr_time max_clr_time total_elapsed_time last_elapsed_time min_elapsed_time max_elapsed_time
---------------------------------------------------------- ---------------------- -------------------- -------------------- ---------------------------------------------------------- ----------------------- ----------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- -------------------- --------------------
0x03000A004A0CC672F8B8A100CF9800000000000000000000 224 386 1 0x05000A004A0CC672B861F904000000000000000000000000 2007-02-08 09:49:08.043 2007-02-08 09:49:08.060 1 318 318 318 318 0 0 0 0 0 0 0 0 3 3 3 3 0 0 0 0 319 319 319 319

热点排行