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
- :
- Installscript execute SQL script and return values
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
Mar 10, 2014
04:47 PM
Installscript execute SQL script and return values
Hi all,
I have an Installscript MSI project that requires me to connect to a (possibly) remote DB engine and figure out the version number before proceeding. I am using the SqlServerSelectLogin2(...) dialog to get the credentials from the user and then using SQLRTTestConnection2(...) to test the authenticity. Once the credentials provided by the user pass, I need to verify that the SQL version is 2008 R2 or above (and not express). If the DB engine was local, I would use the registry route to figure out the version number and that works fine. What I am stumped with is how to detect the version for a remote DB engine. I know I need to run the "SELECT @@VERSION" query using the SQL scripts view but I am at a loss on how to pass data back to the Installscript to take the next steps. Upon searching briefly, I have seen that this is a problem that has come up before and is unsolved (http://community.flexerasoftware.com/showthread.php?163524-How-to-determine-SQL-Server-Version-of-a-remote-machine).
I also tried using the hint provided in the given link to use SQLCMD.exe to execute commands but that poses two problems - the utility is a part of the client tools so the end user is not guaranteed to have it, and writing the results to file will result in a file being generated respective to the server machine, not the client. Because of this, i have come to the conclusion that the only feasible way is to go via the SQL scripts view. My questions are:
1) How to execute a specific SQL script file using installscript (there are multiple files under one component and I would need to execute just one to figure out the version)
2) How to pass data back to the Installscript? Can the properties somehow be used?
Thanks!
Rishi
I have an Installscript MSI project that requires me to connect to a (possibly) remote DB engine and figure out the version number before proceeding. I am using the SqlServerSelectLogin2(...) dialog to get the credentials from the user and then using SQLRTTestConnection2(...) to test the authenticity. Once the credentials provided by the user pass, I need to verify that the SQL version is 2008 R2 or above (and not express). If the DB engine was local, I would use the registry route to figure out the version number and that works fine. What I am stumped with is how to detect the version for a remote DB engine. I know I need to run the "SELECT @@VERSION" query using the SQL scripts view but I am at a loss on how to pass data back to the Installscript to take the next steps. Upon searching briefly, I have seen that this is a problem that has come up before and is unsolved (http://community.flexerasoftware.com/showthread.php?163524-How-to-determine-SQL-Server-Version-of-a-remote-machine).
I also tried using the hint provided in the given link to use SQLCMD.exe to execute commands but that poses two problems - the utility is a part of the client tools so the end user is not guaranteed to have it, and writing the results to file will result in a file being generated respective to the server machine, not the client. Because of this, i have come to the conclusion that the only feasible way is to go via the SQL scripts view. My questions are:
1) How to execute a specific SQL script file using installscript (there are multiple files under one component and I would need to execute just one to figure out the version)
2) How to pass data back to the Installscript? Can the properties somehow be used?
Thanks!
Rishi
(13) Replies