USE master; GO DECLARE @SQL VARCHAR(MAX); SET @SQL=‘‘ SELECT @SQL[email protected]+‘; KILL ‘+RTRIM(SPID) FROM master..sysprocesses WHERE dbid=DB_ID(‘数据库名‘); EXEC(@SQL); ALTER DATABASE 数据库名 SET MULTI_USER;
时间: 2024-10-25 13:36:18
USE master; GO DECLARE @SQL VARCHAR(MAX); SET @SQL=‘‘ SELECT @SQL[email protected]+‘; KILL ‘+RTRIM(SPID) FROM master..sysprocesses WHERE dbid=DB_ID(‘数据库名‘); EXEC(@SQL); ALTER DATABASE 数据库名 SET MULTI_USER;