Delete database if it exists....

Packages and compresses schema and contents of SQL Server databases

Moderators: JonathanWatts, Chris Auckland, David Atkinson, david connell, Anu Deshpande, Michelle Taylor, james.billings, Marianne

Delete database if it exists....

Postby splitpete » Thu Aug 26, 2010 11:07 am

Hi,

I would like to create an exe that installs a database. I am able to do that easily enough. However, if the database already exists on the specified machine, I want the existing database to be deleted and the new version to be installed in its place.

I attempted to do this by creating a script and inserting the appropriate code to perform the delete in the script and then creating an exe from that script. This does not work. The exe tells me there is already a database by that name and won't continue until I provide a different one. I know it has not reached the script at this point.

Is there a way to do this?

Thanks in advance

-splitpete
splitpete
 
Posts: 5
Joined: Thu Aug 26, 2010 10:53 am

Return to SQL Packager 6

Who is online

Users browsing this forum: No registered users and 0 guests