![]() ![]()
Msg 2812, Level 16, State 62, Server BUILDEV\BUILD, Line 1 )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON NOT NULL,ĬONSTRAINT PRIMARY KEY CLUSTERED ![]() IF NOT EXISTS(select * from Sys.tables where name='HRMEmployeeTransfer') IF NOT EXISTS(select * from syscolumns where Name like 'TransferFlag' and Id = Object_id('hraemployee'))Īlter table hraemployee add TransferFlag bit NULL I am having problem using sqlcmd.exe in wix when sql script file has If logic like Print convert(varchar(25),GetDate(),121) ' Executing file: Test.sql' I have found this is working quite well and fits in with my method of building SQL scripts for database creation. If INSTALLDIR is the location, just create a registry item (using the standard IDE) in the location of your choice and give it the value INSTALLDIR and this will resolve to the actual location when the item is written to the registry. You can also change the attribute to "no" to execute in the context of the local system account (in my case I find this a better option). This will use the current users context to execute the script, that user must have permissions to execute the script. It writes the output of the command to the log file "Test.log". The command passes in the parameter "SYSTEM_USER". In this case the database is the local SQLEXPRESS instance and it uses a trusted connection (-E). This section builds the command line for sqlcmd. This sections finds the path to the sqlcmd.exe by searching the registry for the path to sql binn folder. #Installbuilder delete installdir if installer fails fullI have included a full working sample at the end of this post but the key sections are as follows: I looked at using the inbuilt WiX custom actions but they don't accept parameters so I decided to run sqlcmd from WiX using a custom action. #Installbuilder delete installdir if installer fails installThe script requires several parameters and the current version of the install (Wise Install Builder) uses the sqlcmd.exe to substitute the values using the -v option. Then the installer of the target application would proceed ahead.I have been working on an install pack that needs to run and sql script. A possible solution I am thinking of now is to run the other application's installer in the background - using an ampersand (
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |