Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
MGA
Starting Member
28 Posts |
Posted - 2010-05-28 : 04:21:42
|
| How to check for the existence of a database and if it exists drop itlike thatif exists (drop database Dbname) |
|
|
vaibhavktiwari83
Aged Yak Warrior
843 Posts |
Posted - 2010-05-28 : 04:27:56
|
| IF EXISTS( SELECT 1 FROM sys.databases WHERE name = 'dbname')BEGIN DROP DATABASE dbnameENDVaibhav TTo walk FAST walk ALONE To walk FAR walk TOGETHER |
 |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-05-28 : 04:30:41
|
use mastergoif db_id('your_db_name') is not nullDROP DATABASE your_db_name No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
|
|
|