移除sql数据所有链接用户
时间:2021-07-01 10:21:17
帮助过:10人阅读
go
declare @temp nvarchar(20)
declare myCurse cursor
for
select spid
from sys.sysprocesses
where dbid=DB_ID(‘数据库名称‘)--待清理的数据库
open myCurse
fetch next from myCurse into @temp
while @@FETCH_STATUS=0
begin
exec(‘kill ‘+ @temp)
fetch next from myCurse into @temp
end
close myCurse
deallocate myCurse;移除sql数据所有链接用户
标签:end mes 链接 -- kill sse uri pen close