Delete single user database SQL Server
Delete single user database SQL Server
Tags: blogger
May 21, 2019 at 04:43PM
Open in Evernote
USE master
GO
DECLARE @kill varchar(max) = '';
SELECT @kill = @kill + 'KILL ' + CONVERT(varchar(10), spid) + '; '
FROM master..sysprocesses
WHERE spid > 50 AND dbid = DB_ID('Quicksilver.Cms')
EXEC(@kill);
GO
SET DEADLOCK_PRIORITY HIGH
ALTER DATABASE [Quicksilver.Cms] SET MULTI_USER WITH NO_WAIT
ALTER DATABASE [Quicksilver.Cms] SET MULTI_USER WITH ROLLBACK IMMEDIATE
GO
Tags: blogger
May 21, 2019 at 04:43PM
Open in Evernote
Comments
Post a Comment