SQL Server/T-SQL Tutorial/Data Convert Functions/DROP DATABASE
Code that tests whether a database exists before it deletes it
4>
5> IF DB_ID("TestDB") IS NOT NULL
6> DROP DATABASE TestDB
7> GO
1>
2> CREATE DATABASE TestDB
3> GO
1>
2> create table Billings (
3> BankerID INTEGER,
4> BillingNumber INTEGER,
5> BillingDate datetime,
6> BillingTotal INTEGER,
7> TermsID INTEGER,
8> BillingDueDate datetime ,
9> PaymentTotal INTEGER,
10> CreditTotal INTEGER
11>
12> );
13> GO
1>
2>
3> IF OBJECT_ID("Billing") IS NOT NULL
4> DROP TABLE Billing
5> GO
1>
2> DROP DATABASE TestDB;
3> GO
The DROP Database Statement
DROP DATABASE Accounting