This article has been read [post_view] times. This article has been read [post_view time="day"] times today. This article has been read [post_view time="month"] times this month. This article has been read [post_view time="year"] times this year. This article has 133 total words. (Including header) This article has been updated on [rup_display_update_date] [tweet] |
To test if I can drop the [gs database]:
IF db_id('Database1') is not null
DROP DATABASE Database1
[tweet]On the other case, to test if I can create the database:
IF db_id('Database1') is null
CREATE DATABASE Database1
T-SQL – Control if a database exists before creating or dropping it http://heelpbook.altervista.org/2012/t-sql-control-if-a-database-exists-before-creating-or-dropping-it/ via @HeelpBook