MS SQL Server
This plug-in provided command executes a SQL script on an instance of Microsoft SQL Server. Supported server platforms include SQL Server 7, SQL Server 2000 through 2017 (inclusive), and MSDE.
Server
Enter the network name or IP address of the physical machine that the server instance resides on. Use localhost for the local machine.
You may also enter in a specific port to connect. Type the port number immediately after the network name, separating the two fields with a comma, and without spaces. An example value could be servername,1433.
Other ports that may be used include 445.
Instance
Enter the name of the SQL Server instance that the script will execute on.
Database
Enter the name of the database to connect to, or the database to create if you wish to create a new database on the server instance.
Create Database If Absent
If you wish to create a new database, check this box.
User
Enter the name of a user authenticated to make changes on the SQL Server instance.
Password
Enter the password for the user named in the User field.
Return result in variable
Indicates the variable to hold the result of the script execution. If specified, this variable must have been previously defined in the setup script using the Set Variable command.
The variable will hold one of the following values, or a custom error message as described below:
Value | Meaning |
---|---|
SUCCESS | Connection to the database succeeded. The script executed successfully, or there were some script execution errors and was not checked. |
CONNECT_ERROR | Connection to the server failed. |
CONNECT_DATABASE_ERROR | Connection to the database failed. |
ERROR | An unknown error occured. |
In addition to the values in the table above, when Parse String function to extract both fields and utilize them separately.
is checked, and an error occurs during script execution (where database and server connections succeeded), this variable holds detailed error information as follows: The variable is split into two parts, delineated by the string literal . The first part of the variable holds the exact textual error message. The second part of the variable holds the exact SQL script fragment where execution errors occured. You may parse the variable using theAbort Exection on Script Error
Check this box to halt processing of the SQL script if any SQL statement fails. Uncheck this box to allow the SQL script to continue execution even if some SQL statements fail.
SQL Script
Type the SQL script to execute here, or click the
button to load the script from a text file.Notes
- You may use variables in your SQL scripts and connection fields.
- It is strongly recommended that MDAC 2.8 be installed on the target system before this command executes. No other client software is required on the target system. MDAC 2.8 may be installed using the MDAC Refresh command.
- If you wish to load your #FILESCRIPT# value to indicate this. This option is especially useful for very long scripts that contain tens of thousands of lines. If your script has the value #FILESCRIPT# at the first position in the first line of the field, the script will be read from the file following the value. For instance, if you enter the value #FILESCRIPT#$SUPPORTDIR$\sqlscript.sql into the field, the plug-in will load the file sqlscript.sql from the installer's support files (creatives) folder at run-time, and execute the script contained within that file. from a file at runtime, use the special
- If a user name is specified in the field, SQL authentication will be used. If the field is empty, Windows authentication will be used.