This page allows you to configure SQL Scripts. When adding a script to the project you will be prompted to select a script file from the disk.

General

SQL Script File

Specify the script file. Use [ ... ] button to select it.

Statement separator (SQL Batch file separator)

Specify the separator for the SQL statements.

ImportantBy default this field is empty; if you supply a statement separator (Eg. semicolon ; or GO ), during installation the SQL script batch file will be automatically split into component statements using the supplied statement separator and each SQL statement will be executed individually. Otherwise, SQL script will be executed as a whole. Format: with the exception of semicolon ; , the statement separator must always begin with a letter and can contain only alpha-numeric characters.

NoteSome Database Servers do not permit executing multiple statements at once. In this case supply a statement separator to indicate that the SQL queries should be executed individually. For more information please read Why does my SQL Script fail to run when executed from the installer? FAQ.

Strip comments from SQL script

Removes all comments from the SQL script. (This option also removes SQL comments from your stored procedures, if any.)

Script Execution

Run SQL Script

Select when the SQL script should be executed. You have three options:

  • At install
  • During maintenance (repair or modify)
  • At uninstall
  • During rollback

Warning!The changes made by an SQL Script on a database cannot be undone. Uninstall won't rollback the changes performed by the SQL statements. You will need to supply, if necessary, SQL scripts scheduled to run at uninstall or rollback that will undo changes made by the scripts ran during install.

Script Condition

Condition the script's execution. Use the [ ... ] button. The Edit Condition Dialog will be displayed allowing you to edit a condition.

TipIf none of the SQL scripts assigned to an SQL connection is to be executed due to their condition or scheduling, that SQL connection will not be triggered.

In case of error

Specify the action that should be taken if an SQL script error is encountered when the script is executed.

NoteIf you choose to go to the SQL script file's next statement in case of script execution error you will need to supply a statement separator for the SQL script.

Script Replacements

This section enables you to replace certain sections of your script. These replacements can use installer properties and they are executed when the package is built.

Adding a new SQL replacement

Use the [ Add... ] button, the “Add...” context menu item or press the Insert key while the list is focused. The SQL Script Replacement Dialog dialog will be displayed allowing you to create a new SQL replacement.

Editing an SQL replacement

Use the [ Edit... ] button, the “Edit...” context menu item or press the Space key while an element from the list is selected. The SQL Script Replacement Dialog dialog will be displayed allowing you to edit an SQL replacement.

Removing an SQL replacement

Use the [ Remove ] button, the “Remove” context menu item or press the Delete key while an element from the list is selected.

SQL Script Execution Sequence

The SQL scripts of an SQL connection are executed in the order they appear in the tree (top-down). To change the execution order, move them by drag and drop in the tree.

Disclaimer

ImportantMake sure the SQL code you supply is well-tested before deployment. If errors occur during installation, the changes cannot be undone. This functionality assumes familiarity with SQL syntax. Advanced Installer Technical Support does not provide assistance with debugging SQL statements.

Topics