USE master; GO DECLARE @SQL VARCHAR(MAX); SET @SQL='' SELECT @SQL=@SQL+'; KILL '+RTRIM(SPID) --杀掉该进程FROM master..sysprocesses WHERE dbid=DB_ID('cnpc'); EXEC(@SQL);ALTER DATABASE cnpc SET MULTI_USER; --改成多用户 https://www.cnblogs.com/reailcooker/p/99681