USE 你的库名 GO BEGIN --查询锁表 SELECT request_session_id AS spid ,OBJECT_NAME(resource_associated_entity_id) AS tableName FROM sys.dm_tran_locks where resource_type='OBJECT' --解锁 DECLARE @spid INT ,@sql VARCHAR(1000) SET @spid = 104 --锁表进程 SET @sql='kill '+CAST(@spid AS VARCHAR(50)) EXEC(@sql) END