select spIdfrom master..SysProcesseswhere db_Name(dbID) = 'Tb_axxxxx'and spId <> @@SpIdand dbID <> 0
--先查后解除
declare @spid intSet @spid = 149 --锁表进程declare @sql varchar(1000)set @sql='kill '+cast(@spid as varchar)exec(@sql)