--把 DBCC INPUTBUFFER 生成报表...SELECT execution_count [Number of Executions], total_worker_time/execution_count AS [Average CPU Time], Total_Elapsed_Time/execution_count as [Average Elapsed Time], (SELECT SUBSTRING(text,statement_start_offset/2, (CASE WHEN statement_end_offset = -1 then LEN(CONVERT(nvarchar(max), text)) * 2 ELSE statement_end_offset end -statement_start_offset)/2) FROM sys.dm_exec_sql_text(sql_handle)) AS query_text FROM sys.dm_exec_query_stats ORDER BY [Average CPU Time] DESC
执行上面sql后结果: [Number of Executions] [Average CPU Time] [Average Elapsed Time] query_text 1 1005 18969 select ID from Oper_Log order by id as
我直接搜索了一下,原来的sql语句是: select ID from Oper_Log order by id asc 请问,执行的时候怎么会在sql语句的最后少一个“c”呢?
不是动态sql.这些sql都是在asp页面里面写死的语句.我就不明白了.执行上面sql后结果: [Number of Executions] [Average CPU Time] [Average Elapsed Time] query_text 1 1005 18969 select ID from Oper_Log order by id as怎么到数据库执行的时候,sql语句就少了一个字母?
execution_count [Number of Executions],
total_worker_time/execution_count AS [Average CPU Time],
Total_Elapsed_Time/execution_count as [Average Elapsed Time],
(SELECT SUBSTRING(text,statement_start_offset/2,
(CASE WHEN statement_end_offset = -1 then
LEN(CONVERT(nvarchar(max), text)) * 2
ELSE statement_end_offset
end -statement_start_offset)/2)
FROM
sys.dm_exec_sql_text(sql_handle)) AS query_text
FROM
sys.dm_exec_query_stats
ORDER BY [Average CPU Time] DESC
[Number of Executions] [Average CPU Time] [Average Elapsed Time] query_text
1 1005 18969 select ID from Oper_Log order by id as
select ID from Oper_Log order by id asc
请问,执行的时候怎么会在sql语句的最后少一个“c”呢?
记录create\drop\alter等用DDL触发器
--------------看联机帮助有例子以上方法是返回当前数据库执行过的语句..
------------------
[Number of Executions] [Average CPU Time] [Average Elapsed Time] query_text
1 1005 18969 select ID from Oper_Log order by id as怎么到数据库执行的时候,sql语句就少了一个字母?