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 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
‎May 07, 2008
02:08 PM
Installscript SQL SERVER
I have an installscript project and I have a sql connection that uses the default dialog box, i would like to be able to use installscript to print out into my log file the SQL Server and the datbase that was selected for that dialog.
(23) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 14, 2008
01:37 PM
You need to write your code that will open your SQL script files and parse SQL batches to be sent to servers if you write an ADO application. There is a sample code available in the SQL Server Database Maintenance section at http://www.installsite.org/pages/en/isp_db.htm.
If you do not want to write that code, you may want to consider using osql Utility or sqlcmd Utility provided by Microsoft to execute your SQL scripts. You can launch the command line utility from your setup using the LaunchAppAndWait() InstallScript function.
Hope that helps.
If you do not want to write that code, you may want to consider using osql Utility or sqlcmd Utility provided by Microsoft to execute your SQL scripts. You can launch the command line utility from your setup using the LaunchAppAndWait() InstallScript function.
Hope that helps.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 14, 2008
09:30 PM
When trying to use LaunchAppAndWait I am trying to run CMD.exe and pass in the sqlcmd string but all I can get is the command prompt window to open.
Example:
This will open up the command window but does not execute the line.
Is there a way to accomplish this?
Example:
LaunchAppAndWait(WINSYSDIR^"cmd.exe","sqlcmd -S myServer -d myDB -E -i mySQLscript.sql", WAIT);
This will open up the command window but does not execute the line.
Is there a way to accomplish this?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎May 14, 2008
10:16 PM
I figured it out I had to add some more stuff to my svString. I have changed around to work like so.
It is very important to get the delimiters correct and add the space infront of the /C you could also use a /K if you want the window to stay open.
I hope the work I have done and that you have helped me with in this thread helps other people. 😉
svString = " /C \"sqlcmd -S mySQLServer -d myDB -E -i \"" + SUPPORTDIR^"mySQLScript.sql" + "\""
LaunchAppAndWait(WINSYSDIR^"cmd.exe",svString,WAIT);
It is very important to get the delimiters correct and add the space infront of the /C you could also use a /K if you want the window to stay open.
I hope the work I have done and that you have helped me with in this thread helps other people. 😉
![](/skins/images/3B39CE851FDD5528C393F146EB70A2D0/responsive_peak/images/icon_anonymous_message.png)