Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 3

Error with "Create Database If Absent" option for SQL Connection

I have a SQL Connection with the option to "Create Catalog If Absent" checked.
The catalog does not exist.
When running the install, I use Windows Auth and/or SQL Auth and it fails with the error:

Error 27552. Error creating database ***. Server: Microsoft SQL Server (local). CREATE DATABASE failed. Some file names listed could not be created. Check related errors. (1802).

I know the credentials are good, because if I choose a db catalog that exists, there is no error, no problem.

I cannot figure out a way around this.
Labels (1)
0 Kudos
(3) Replies
Level 17

Are you able to create a database on the server with the same login account from Microsof SQL Server Management Studio?
0 Kudos
Level 3

Yes, I can create a database with the same credentials in SSMS. I am logged in as the local machine admin, and I have logged into SSMS as the user "sa".
0 Kudos
Level 7

I have seen this error before when I was building an installer with IS 2011 and 2012 both. I couldn't get rid of it.

The way I got around it was I unchecked the checkbox 'Create Database If Absent' in SQL Connection. Instead, I did following steps.
1. Check in InstallScript if SQL database already exists. If it does set a property.
2. Execute create database script only if this property is true.

Also, just for fun I wrote a C# class custom action that would execute a SQL script CreateDatabase(), if there's an exception, depending upon type of exception I would know if it was because the database already existed or because there were unattached mdf/ldf files with same name as the database being created. In later case, I would ask the user if they want to reattach the files to database or create a new one. If they chose to reattach, simply run a SQL script reattaching the files to the db, if they chose to create new db, rename the mdf/ldf.

Hope this info helps. Let me know if you have questions or need help with any of these options above.
0 Kudos