This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Create database SQL script after installation of SQL Server
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 15, 2010
02:52 PM
Create database SQL script after installation of SQL Server
Hello
I am doing a silent installation of SQL Server 2008 via prerequisite, the INSTANCE name of the SQL Server installation uses a property that is passed in (the user sets this via a textbox in a dialog).
However once the SQL Server installation is complete I then wish to automatically run a database script (which includes database creation), I am attempting to do this using the SQL Scripts options, but I cannot work out how to get the INSTANCE name property and then use this in my script? Can this be done (I am using a Basic MSI project).
I tried messing about with Advanced tab in scripts the property "Target Server Property Name" and changing this to be the database the user types but I cannot get it to work, can it be done, and I am going about it the right way?
Thank you very much.
David
I am doing a silent installation of SQL Server 2008 via prerequisite, the INSTANCE name of the SQL Server installation uses a property that is passed in (the user sets this via a textbox in a dialog).
However once the SQL Server installation is complete I then wish to automatically run a database script (which includes database creation), I am attempting to do this using the SQL Scripts options, but I cannot work out how to get the INSTANCE name property and then use this in my script? Can this be done (I am using a Basic MSI project).
I tried messing about with Advanced tab in scripts the property "Target Server Property Name" and changing this to be the database the user types but I cannot get it to work, can it be done, and I am going about it the right way?
Thank you very much.
David
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 15, 2010
05:26 PM
If you want to use the information for the target database server on the SQLLogin dialog, you need to set it to the IS_SQLSERVER_SERVER property. Here is a sample Control Event that will set the value of the MYPROP_USERINPUT property to the IS_SQLSERVER_SERVER property:
Event: [MYPROP_USERINPUT]
Argument: [IS_SQLSERVER_SERVER]
Condition: 1
If you want to use the information in your SQL script, you can use the Text Replacement functionality provided in the SQL Script view. Here is a sample Text Replacement entry that will replace %DBNAMEHOLDER% with the value of the MYPROP_USERINPUT property:
Find What: %DBNAMEHOLDER%
Replace With: [MYPROP_USERINPUT]
and your SQL script will look like this:
CREATE DATABASE %DBNAMEHOLDER%
Hope that helps.
Event: [MYPROP_USERINPUT]
Argument: [IS_SQLSERVER_SERVER]
Condition: 1
If you want to use the information in your SQL script, you can use the Text Replacement functionality provided in the SQL Script view. Here is a sample Text Replacement entry that will replace %DBNAMEHOLDER% with the value of the MYPROP_USERINPUT property:
Find What: %DBNAMEHOLDER%
Replace With: [MYPROP_USERINPUT]
and your SQL script will look like this:
CREATE DATABASE %DBNAMEHOLDER%
Hope that helps.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 16, 2010
11:55 AM
Thanks very much.
David
David