I have an installer which as part of the installation creates a SQL Server 2000 (and up) database.
Some users change database server, detach database, ... and want to reinstall.
If the file exists in the default location I get the following error:
Cannot create file 'C:\Program Files\Microsoft SQL Server...\DATA\mydatabase.mdf' because it already exists.
I can solve this by checking the default path first and deleting the files. But how can I do this when the user installs to a remote SQL Server?
I'm looking for something like:
CREATE DATABASE mydatabase WITH OVERWRITE
Edit:
Drop database is not the solution. The database does not exist but the files are still there.