If I pre-create database and run all other scripts which dont need CMDSQL, everything works perfectly.
So, how to run CMDSQL before running first scirpt?
I found an answer on forum but I dont understand it perfectly:
Thank you for answer.Ionut wrote:Hi Kiran,
First, you need to create a File Search in the Search page for "sqlcmd.exe" and name it for instance SQLCMD. Right-click on the search and select "Add Location -> Folder", specifying the following parameters:
- Path : [ProgramFilesFolder]Microsoft SQL Server
- Depth : 5
If you are using SQL Server 2000/MSDE, search for "osql.exe" instead of "sqlcmd.exe". Use the "Test Search" toolbar button in order to make sure the Search is configured correctly.
In the Custom Actions page, create a new "EXE with Working Dir" Custom Action under Install, with the following parameters:
- Working Dir: (any)
- Full Path:- Execution Properties: Synchronous execution, ignore return codeCode: Select all
"[SQLCMD]" -S .\InstanceName -U user -P password -i "[#RestoreScript.sql]"
- Execution Options: Deferred with no impersonation
- Execution Condition: (Not Installed) AND SQLCMD
Replace SQLCMD with the Property you have used to name your Search and instead of "RestoreScript.sql" select the SQL script file from your package (use the "Edit" button at the right of the "Full Path" field).
Hope this helps.
Regards,
Ionut

FOLLOW US
Get the latest news in Application Packaging