移除sql数据所有链接用户

use master;

 

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数据所有链接用户

您可能还会对下面的文章感兴趣: