杀数据库连接:
DECLARE @temp NVARCHAR(20) DECLARE myCurse CURSOR FOR SELECT spid FROM sys.sysprocesses WHERE dbid = DB_ID('YourDatabaseName') 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
版权声明:本文博客原创文章,博客,未经同意,不得转载。