PDA

View Full Version : How to Execute Stored Procedure



rguggisberg
01-28-2016, 06:14 PM
How can I execute a Stored Procedure in my InstallScript MSI project? I already have SQL connectivity and am running scripts, but I don't think the SQL Scripts view is relevant for SPs. I am considering using SQLCMD in a LAUNCHAPPANDWAIT command in my InstallScript code, but I can't even get the command line correct from a command prompt on the target machine.
I also have 2 variables to pass and not sure how to do that either. Can't post what I have tried here because site won't allow it.
Any help is appreciated. Maybe there is a better way to do it. I do know that SQLCMD will be installed, but can't rely on other things being installed.
Thanks

ch_eng
02-05-2016, 04:52 PM
rguggisberg,

We use ADO via InstallScript to execute special SQL scripts. The code is based on the example found here:

http://www.installsite.org/pages/en/isp_db.htm

SQL Server Database Maintenance
DatabaseFunctions.zip

HTH

rguggisberg
02-05-2016, 05:24 PM
Thanks for reminding me :)
I got this to work by executing LaunchAppAndWait on SQLCMD in a CA. I tried to post part of it here but this sites security rules will not accept it.