add some db recycle features...

This commit is contained in:
Ivan Hörler 2018-06-18 22:05:23 +02:00
parent a73c25bc9c
commit 41418b2495
1 changed files with 28 additions and 0 deletions

View File

@ -4,8 +4,35 @@
-- --------------------------------------------------
-- Date Created: 06/09/2018 13:24:19
-- Generated from Cadaroski Ismail
-----------------------------------------------------
-- CHANGE LOG:
-- 180618 Ivan, Add Create DB
-- --------------------------------------------------
-- Auskommentieren für Löschung der Datenbank
IF db_id('EHEC_DB') is not null
BEGIN;
PRINT 'EHEC_DB existiert bereits, sie wird nun geloescht und neu Gebaut'
USE [master];
DROP DATABASE EHEC_DB;
END;
ELSE
BEGIN;
PRINT 'EHEC_DB existiert noch nicht, die Datenbank wird nun neu Gebaut';
END;
GO
-- Datenbank erstellen:
IF db_id('EHEC_DB') is null
BEGIN;
CREATE DATABASE EHEC_DB;
END;
ELSE
BEGIN;
PRINT 'EHEC_DB existiert bereits, Tabellen werden nun gelöscht...';
END;
GO
SET QUOTED_IDENTIFIER OFF;
GO
USE [EHEC_DB];
@ -204,5 +231,6 @@ ON [dbo].[Exam]
GO
-- --------------------------------------------------
PRINT 'Erfolgreich erstellt..!';
-- Script has ended
-- --------------------------------------------------