Integrate check for connections into check for DB existance to avoid error on new creations of EHEC_DB
This commit is contained in:
parent
971348764e
commit
f7be1ac531
|
@ -11,20 +11,14 @@
|
||||||
-- 180629 Ivan, Add inserts for fixed lists
|
-- 180629 Ivan, Add inserts for fixed lists
|
||||||
-- --------------------------------------------------
|
-- --------------------------------------------------
|
||||||
|
|
||||||
-- Set DB toSingle User so open connections do not block
|
|
||||||
-- --------------------------------------------------
|
|
||||||
PRINT 'Set Multiuser to Singleuser so all open connections are cut...';
|
|
||||||
use master
|
|
||||||
ALTER DATABASE EHEC_DB SET SINGLE_USER WITH ROLLBACK IMMEDIATE
|
|
||||||
-- --------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- Auskommentieren für Löschung der Datenbank
|
-- Auskommentieren für Löschung der Datenbank
|
||||||
IF db_id('EHEC_DB') is not null
|
IF db_id('EHEC_DB') is not null
|
||||||
BEGIN;
|
BEGIN;
|
||||||
PRINT 'EHEC_DB already EXISTS, db will be deleted for a new creation.'
|
PRINT 'EHEC_DB already EXISTS, Set Multiuser to Singleuser so all open connections are cut...';
|
||||||
USE [master];
|
USE [master];
|
||||||
|
-- Set DB toSingle User so open connections do not block Destroy of DB
|
||||||
|
ALTER DATABASE EHEC_DB SET SINGLE_USER WITH ROLLBACK IMMEDIATE
|
||||||
|
PRINT 'DB will be deleted for a new creation.'
|
||||||
DROP DATABASE EHEC_DB;
|
DROP DATABASE EHEC_DB;
|
||||||
END;
|
END;
|
||||||
ELSE
|
ELSE
|
||||||
|
|
Loading…
Reference in New Issue