查询Spid 下对应Sql语句

select er.session_id
, CAST(csql.text AS varchar(255)) AS CallingSQL
from master.sys.dm_exec_requests er 
WITH (NOLOCK)
       CROSS APPLY MASTER.sys.fn_get_sql (er.sql_handle) csql
where er.session_id =51

session_id即为 Spid

posted @ 2015-03-06 15:40  xfyn  阅读(1376)  评论(0编辑  收藏  举报