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:
Code: Select all
"[SQLCMD]" -S .\InstanceName -U user -P password -i "[#RestoreScript.sql]"
- Execution Properties: Synchronous execution, ignore return code
- 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