db_AI-4/sql/sql/setup_04_remove_database.sql

66 lines
1.6 KiB
SQL

-- Removes the tables for the market DB
--
-- Author: Andreas Zweili
-- Erstellt: 2017-05-27
-- DB-Server SQL Server 2016
use marketdb;
if exists (select * from sysobjects where name='commercials')
DROP TABLE commercials;
use marketdb;
if exists (select * from sysobjects where name='member_status')
DROP TABLE member_status;
use marketdb;
if exists (select * from sysobjects where name='salutations')
DROP TABLE salutations;
use marketdb;
if exists (select * from sysobjects where name='subscriptions')
DROP TABLE subscriptions;
use marketdb;
if exists (select * from sysobjects where name='subscption_orders')
DROP TABLE subscption_orders;
use marketdb;
if exists (select * from sysobjects where name='members')
DROP TABLE members;
use marketdb;
if exists (select * from sysobjects where name='persons')
DROP TABLE persons;
use marketdb;
if exists (select * from sysobjects where name='trial_periods')
DROP TABLE trial_periods;
use marketdb;
if exists (select * from sysobjects where name='quality_checks')
DROP TABLE quality_checks;
use marketdb;
if exists (select * from sysobjects where name='cities')
DROP TABLE cities;
use marketdb;
if exists (select * from sysobjects where name='countries')
DROP TABLE countries;
use marketdb;
if exists (select * from sysobjects where name='rents')
DROP TABLE rents;
use marketdb;
if exists (select * from sysobjects where name='locations')
DROP TABLE locations;
use marketdb;
if exists (select * from sysobjects where name='rent_prices')
DROP TABLE rent_prices;
use master;
if exists (select * from sys.databases where name='marketdb')
drop DATABASE marketdb;