Creating a Sample Installation that Creates a SQL Server Database by Running Customized SQL Script
                                                InstallShield 2025
                                                
                                                Project:
                                                    This information applies to the following project types:
                                                
                                                
                                                The following procedure demonstrates how to create an installation that creates a SQL Server database through customized SQL script.
                                                To create an installation that creates a SQL Server database on the target machine by running customized SQL script:
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | 1. | Create a new Basic MSI or InstallScript MSI project. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | 2. | In the View List under Behavior and Logic, click Property Manager. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | 3. | Create a new property that has the following name: | 
                                                
                                                IS_SQLSERVER_DATABASE2 
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | 4. | In the View List under Server Configuration, click SQL Scripts. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | 5. | Add and configure a new SQL connection: | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | a. | Right-click the SQL Scripts explorer and click New SQL Connection. InstallShield adds a new connection with the name NewConnection1 as the default name. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | b. | In the SQL Scripts explorer, click the NewConnection1 item, and then click the General tab. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | c. | In the Default Target Server Name (optional) box, type TESTSQLSERVER. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | d. | Clear the Create Catalog If Absent check box. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | e. | In the Connect using area, select the Server authentication using the Login ID and password below option. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | f. | In the Login ID box, type sa. Leave the Password box blank. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | g. | Click the Requirements tab. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | h. | Ensure that the Microsoft SQL Server check box is selected and the MySQL and Oracle check boxes are cleared. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | 6. | Add and configure a new SQL script for NewConnection1: | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | a. | In the SQL Scripts explorer, right-click NewConnection1 and click New Script. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | b. | Change the name of the script to NewScript1. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | c. | In the SQL Scripts explorer, click NewScript1, and then click the Script tab. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | d. | In the script editor pane, add the following script: | 
                                                
                                                CREATE DATABASE [TestDB] ON (NAME = N' TestDB', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\data\testdb.mdf' , SIZE = 3, FILEGROWTH = 10%) LOG ON (NAME = N' TestDB_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL\data\testdb.ldf' , SIZE = 1, FILEGROWTH = 10%)
                                                COLLATE SQL_Latin1_General_CP1_CI_AS
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | e. | Click the Runtime tab. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | f. | In the Script Execution area, select the Run Script During Login check box and ensure that the Run Script During Install and Run Script During Uninstall check boxes are cleared. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | 7. | Add and configure a second new SQL connection: | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | a. | Right-click the SQL Scripts explorer and click New SQL Connection. InstallShield adds a new connection with the name NewConnection2 as the default name. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | b. | In the SQL Scripts explorer, click the NewConnection2 item, and then click the Advanced tab. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | c. | In the Target Catalog Property Name list, select IS_SQLSERVER_DATABASE2. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | d. | Click the General tab. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | e. | In the Catalog Name box, type TestDB. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | f. | Clear the Create Catalog If Absent check box. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | g. | In the Default Target Server Name (optional) box, type TESTSQLSERVER. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | h. | In the Connect using area, select the Server authentication using the Login ID and password below option. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | i. | In the Login ID box, type sa. Leave the Password box blank. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | j. | Click the Requirements tab. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | k. | Ensure that the Microsoft SQL Server check box is selected and the MySQL and Oracle check boxes are cleared. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | 8. | Add and configure a new SQL script for NewConnection2: | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | a. | In the SQL Scripts explorer, right-click NewConnection2 and click New Script. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | b. | Change the name of the script to NewScript2. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | c. | In the SQL Scripts explorer, click NewScript2, and then click the Script tab. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | d. | In the script editor pane, add the following script: | 
                                                
                                                CREATE TABLE TestTable (TestColumn1 CHAR NOT NULL PRIMARY KEY)
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | e. | Click the Runtime tab. | 
                                                
                                                
                                                    
                                                    
                                                    
                                                    
                                                        |  | f. | In the Script Execution area, select the Run Script During Install check box and ensure that the Run Script During Login and Run Script During Uninstall check boxes are cleared. | 
                                                
                                                When you run the installation, it creates the TestDB database and adds a table called TestTable to that database.
                                                Project:You can achieve the same outcome when following the above procedure but using a DIM project, and then adding the DIM to an installation project.