一、查看锁
select * from sysprocesses where blocked<>0
二、SqlServer经常因为某些语句或事物的误操作造成死锁。
查询导致死锁的表和进程ID:
select request_session_id spid,
OBJECT_NAME(resource_associated_entity_id) tableName from
sys.dm_tran_locks
where
resource_type='OBJECT
杀掉死锁:
kill spid