cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
DotNetShannon
Level 2

Specify collation when creating database

Is it possible to specify a collation via InstallShield's built-in database creation feature? Reason being is that I have a Windows application that formats dates for the region specified by the OS and submits them to a database. Currently, the SQL database that gets created by my InstallShield setup is configured for SQL_Latin1_General_CP1_CI_AS (English - United States), so whenever a customer has Windows configured for something other than (English - United States) my application will run into troubles.

Ideally, it would be great if the InstallShield setup could detect the region of the OS its running on and create the database with the right collation.
Labels (1)
0 Kudos
(3) Replies
hidenori
Level 17

You need to turn off the Create Catalog If Absent option, and use your custom SQL script that will create your database. The Create Catalog If Absent option sends a CREATE DATABASE statment with omitting the COLLATE argument. Therefore, the database is assigned the default collation of the instance of SQL Server.
0 Kudos
salochin
Level 2

This is what I need to do in my installer.

How do I access a variable/property containing the catalog name specified by the user in the sql details dialog? I'm supposing that it is possible to use the text replacement feature to do this replace a placeholder in my script with the database name specified by the user...

(Im new to install shield so forgive me if this is a dumb question)
0 Kudos
hidenori
Level 17

In Basic MSI projects, the catalog name field on the SQLLogin dialog is associated with the IS_SQLSERVER_DATABASE Windows Installer property by default. In order to use the catalog name in your SQL script, you need to have a text replacement entry as follows:

Find What: %CatalogName_Placeholder%
Replace With: [IS_SQLSERVER_DATABASE]

and your SQL script would be like this:
CREATE DATABASE %CatalogName_Placeholder%

Hope that helps.
0 Kudos