Database already exists even after deleting the database files Database already exists even after deleting the database files database database

Database already exists even after deleting the database files


The database information is maintained by sql server express. So just deleting the file doesn't remove the database from sql server. You need to detach the database and then your logic should work. Try sql server management studio express 2008. Or try connect to sql server express programmatically and execute sp_detach_db permissions.

Source : MSDN


A Database is not only MDF and LDF files but also a record in the master database. So you should drop this record about your DB using DROP DATABASE command or through MSSQL Enterprise Manager.