CREATE DATABASE failed when installing Cronus Sample Database

Today I did run into a problem installing the “Cronus Sample Database”. In the error report view I found this error message

SQL Server option

Cronus Sample Database for Microsoft Dynamics NAV 2009

Fatal error during installation.

 

CREATE DATABASE failed. Some file names listed could not be created. Check related errors.

After click on the open config link on the error report page I located this key part for the problem

Configuring MSI package. Id = ‘SQLDemoDatabase’

MSI log file set to: C:\Users\xxxx\AppData\Local\Temp\1\setup.wix.msi.34.log

Windows Installer: Error: Error -2147217900: failed to execute SQL string, error detail: CREATE DATABASE failed. Some file names listed could not be created. Check related errors., SQL key: CreateDemoDatabase SQL string: CREATE DATABASE [Demo Database NAV (6-0)]

Done configuring MSI package. ReturnCode = 1603

In C:\Users\xxxx\AppData\Local\Temp\1\setup.wix.msi.34.log we find this error in the middle of the file

ExecuteSqlStrings:  Error 0x80040e14: failed to execute SQL string, error: CREATE DATABASE failed. Some file names listed could not be created. Check related errors., SQL key: CreateDemoDatabase SQL string: CREATE DATABASE

MSI (s) (58!A4) [13:05:11:100]: Product: Microsoft Dynamics NAV 6-0 Database for SQL Server — Error 26204. Error -2147217900: failed to execute SQL string, error detail: CREATE DATABASE failed. Some file names listed could not be created. Check related errors., SQL key: CreateDemoDatabase SQL string: CREATE DATABASE [Demo Database NAV (6-0)]

Error 26204. Error -2147217900: failed to execute SQL string, error detail: CREATE DATABASE failed. Some file names listed could not be created. Check related errors., SQL key: CreateDemoDatabase SQL string: CREATE DATABASE [Demo Database NAV (6-0)]

The problem here is data files with the same name as the one we are trying to install already exist in the instance. To fix this problem we need to delete those already existing data files. On SQL server 2008 go to C:\Program Files\Microsoft SQL Server\MSSQL10.(instance name)\MSSQL\DATA and delete Demo Database NAV (6-0).mdf and Demo Database NAV (6-0)_log.LDF. After this start main installer again and execute repair.