sqlserver下Kill 一切銜接到某一數據庫的銜接。本站提示廣大學習愛好者:(sqlserver下Kill 一切銜接到某一數據庫的銜接)文章只能為提供參考,不一定能成為您想要的結果。以下是sqlserver下Kill 一切銜接到某一數據庫的銜接正文
USE master
DECLARE @spid int
DECLARE CUR CURSOR
FOR SELECT spid FROM sysprocesses WHERE dbid = 5
FETCH NEXT FROM CUR INTO @spid
WHILE @@FETCH_STATUS = 0
BEGIN
--EXEC ('KILL ' + @spid )
FETCH NEXT FROM CUR INTO @spid
END
CLOSE CUR
DEALLOCATE CUR