SQL Script Installation - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

jjones
Posts: 68
Joined: Wed Jun 29, 2011 3:30 pm

SQL Script Installation

I need to run the SQL scripts to get the tables into a SQL Express database. Part of the installation checks to see if SQL Express is installed, if it isn't it installs it using a silent install with a preconfigured Configuration.ini file. That part of the install works perfectly. I can run the scripts inside SQL Server Management Studio and have it drop the tables into the database after the AdvancedInstaller is finished. I've stripped out the GO statements from scripts so the SQL Statement Separator I'm using is a ';'.

On the SQL Script page, I create a predefined connection using the following parameters:

Connection Type: Microsoft SQL Server / MSDE
Connection Mode: ODBC Driver
ODBC Driver: SQL Server
Server: [SERVERNAME_PROP] This is a property that I defined and it is [ComputerName]\SQLEXPRESS
Port: 1433
Login timeout: 60
Connection and all its scripts are verbose: CHECKED

Trusted Connection: NOT CHECKED
Username: sa
Use predefined password: Password Entered in both text boxes

Database: Database
Create database if it does not exist: NOT CHECKED

When it gets to running the scripts, it says it can't connect to the database that is listed above. What do I put here? The SQL Express database has no tables in it at all. The first of five scripts is what sets up the initial tables. Should I put the name of the database I want in the "Database" field and then check "Create Database"? If I do this, will I have to modify the first script to assume that the table has been created already? I've checked "Create Database" and it does create the initial database but none of the scripts are run because the tables are not there.

Any help would be appreciated! Thanks.
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: SQL Script Installation

Hello,
Server: [SERVERNAME_PROP] This is a property that I defined and it is [ComputerName]\SQLEXPRESS
Please keep in mind that ComputerName property is resolved at install time. The "Value" field when defining a property in the Install Parameters page is pseudo-formatted type, thus all property references will be resolved at build time.
This could be the source of your trouble.

Also, our related articles can guide you step by step in understanding and establishing a successful SQL connection:
"Configuring Databases with SQL Scripts" tutorial
"ODBC/SQL" how tos

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”