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
- :
- Running SQLCMD
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
Aug 04, 2010
01:38 PM
Running SQLCMD
Hi there
I am writing a Installscript 2010 project and have a requirement to create/populate databases (SQLServer 2008) by connecting to a specified SQLServer from a remote machine.
The original solution was to use the the SQLView functionality (built-in to Installshield), but because there were so many SQL scripts (100+) which had to be run in order it was easier to run the already created batch file and pass in some command line params. Problem is the remote machine may not have SQLCMD.EXE installed, so I will detect a copy and install if necessary.
I launch the following Microsoft SQL Server 2008 Command Line Utilities-->SqlCmdLnUtils.msi and its pre-requisite Microsoft SQL Server 2008 Native Client-->sqlncli.msi during the installation. After these tools have been installed I should now be able to run the batch file containing SQLCMD, however this does not work because there is no environment path set e.g c:\program files\mssqlserver\tools\bin, so the batch file does not know where to pick up SQLCMD unless I explicitly tell it.
I set the environment variable with Installscript and refresh the environment with an API SendMessage call. However the batch file still does not know where SQLCMD is, unless I perform a reboot or re-install the installation.
Are you aware of any work around for this, without performing a re-boot? Perhaps I am going about this the wrong way.
BTW Which files does the SQLView functionality use?
Thanks
I am writing a Installscript 2010 project and have a requirement to create/populate databases (SQLServer 2008) by connecting to a specified SQLServer from a remote machine.
The original solution was to use the the SQLView functionality (built-in to Installshield), but because there were so many SQL scripts (100+) which had to be run in order it was easier to run the already created batch file and pass in some command line params. Problem is the remote machine may not have SQLCMD.EXE installed, so I will detect a copy and install if necessary.
I launch the following Microsoft SQL Server 2008 Command Line Utilities-->SqlCmdLnUtils.msi and its pre-requisite Microsoft SQL Server 2008 Native Client-->sqlncli.msi during the installation. After these tools have been installed I should now be able to run the batch file containing SQLCMD, however this does not work because there is no environment path set e.g c:\program files\mssqlserver\tools\bin, so the batch file does not know where to pick up SQLCMD unless I explicitly tell it.
I set the environment variable with Installscript and refresh the environment with an API SendMessage call. However the batch file still does not know where SQLCMD is, unless I perform a reboot or re-install the installation.
Are you aware of any work around for this, without performing a re-boot? Perhaps I am going about this the wrong way.
BTW Which files does the SQLView functionality use?
Thanks
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Aug 05, 2010
06:21 AM
I think the way round this is to write my own version of an SQLCMD.exe interfaces that already exist within the operating system, in this case Windows 2008.
![](/skins/images/CC38E504FC9E1309DC48ACFEB4925670/responsive_peak/images/icon_anonymous_message.png)