only set multiusermode if singleuser is active

This commit is contained in:
Ivan Hörler 2018-07-29 11:16:31 +02:00
parent f7be1ac531
commit 6eb2aaa4e7
1 changed files with 6 additions and 3 deletions

View File

@ -311,9 +311,12 @@ GO
-- ('EHEC-E')
--GO
-- --------------------------------------------------
PRINT 'Set Singleuser mode back to Multiuser mode.';
-- set DB back to Multiuser so multiconnections are alowed again.
ALTER DATABASE EHEC_DB SET MULTI_USER
IF DATABASEPROPERTYEX('EHEC_DB','UserAccess') = 'SINGLE_USER'
begin;
PRINT 'Set Singleuser mode back to Multiuser mode.';
-- set DB back to Multiuser so multiconnections are alowed again.
ALTER DATABASE EHEC_DB SET MULTI_USER
end;
-- --------------------------------------------------
PRINT 'Successfull created your DB!';
-- Script has ended