数据库被设为单用户状态,无法操作

 

USE master;
GO
DECLARE @SQL VARCHAR(3000);

SET @SQL = '';

SELECT @SQL = @SQL+';

KILL ' + RTRIM(SPID) FROM [sys].[sysprocesses] AS sps WHERE [sps].[dbid] = DB_ID('kingo_jwgl1vcdb');

SET @SQL = SUBSTRING(@SQL, 2, LEN(@SQL));

EXEC(@SQL);
GO

ALTER DATABASE [kingo_jwgl1vcdb] SET MULTI_USER;

 

posted @ 2021-09-17 19:12  红叶舞秋山2021  阅读(88)  评论(0编辑  收藏  举报