select spId from master..SysProcesses
where db_Name(dbID) = '数据库名称' and spId <> @@SpId and dbID <> 0
declare @spid int
Set @spid = 63 --锁表进程
declare @sql varchar(1000)
set @sql='kill '+cast(@spid as varchar)
exec(@sql)
select spId from master..SysProcesses
where db_Name(dbID) = '数据库名称' and spId <> @@SpId and dbID <> 0