SQLServer锁表
场景:同步数据到表的时候卡住了,导致表被锁住了
解决方法:
//先查找相关的ID
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 Set @spid = 128 declare @sql varchar(1000) set @sql='kill '+cast(@spid as varchar) exec(@sql)