sqlserver 鎖表進程及執行的SQL


--一、查進程
select request_session_id spid,OBJECT_NAME(resource_associated_entity_id) tableName
from sys.dm_tran_locks where resource_type='OBJECT'
order by request_session_idsql

--二、查sql select er.session_id, CAST(csql.text AS varchar(2000)) AS CallingSQL from master.sys.dm_exec_requests er WITH (NOLOCK) CROSS APPLY fn_get_sql (er.sql_handle) csql where er.session_id =52
---------session

相關文章
相關標籤/搜索