一,查詢死鎖
//spid :被鎖進程ID。
//tableName:發生死鎖的表名。
select request_session_id spid, OBJECT_NAME(resource_associated_entity_id) tableName from sys.dm_tran_locks where resource_type='OBJECT'
二,殺掉死鎖
KILL spid //kill 111234
三,顯示死鎖信息
exec sp_who2 spid