Excute Process Task for parameters
Hi,
currently I have a cmd file named h.cmd and there is some database setting inside the flie see below attachment. I would like use SSIS Execute Process Task to call this cmd file and pass in the value for the database setting INSTALL_HOST,Install_DB etc rather
than each time open the cmd to modify the connection info. In a work, I will make connection information to store in the package configuration and pass the value to cmd. How can I do it? I saw arguments and StandardInputVariables but I do not know
which one I need to use. And how to use? Thanks
@REM Set the appropriate Database parameters.
set INSTALL_HOST=**
set INSTALL_DB=**
set INSTALL_UID=***
set INSTALL_PWD=***
set QUERYFILE=HelenCmd.sql
call :XECSQL
@REM====================================================================
@REM Invoke the query stored in QUERYFILE
@REM====================================================================
:XECSQL
@sqlcmd -U %INSTALL_UID% -P %INSTALL_PWD% -S %INSTALL_HOST% -d %INSTALL_DB% -i %QUERYFILE% -o %QUERYFILE%.log
goto :EOF
Helen
November 10th, 2010 4:23am
Hi Helen,
We can follow there steps to accomplish the target:
1. Change the batch to be:
@REM Set the appropriate Database parameters.
set INSTALL_HOST=%1
set INSTALL_DB=%2
set INSTALL_UID=%3
set INSTALL_PWD=%4
set QUERYFILE=%5
call :XECSQL
@REM====================================================================
@REM Invoke the query stored in QUERYFILE
@REM====================================================================
:XECSQL
@sqlcmd -U %INSTALL_UID% -P %INSTALL_PWD% -S %INSTALL_HOST% -d %INSTALL_DB% -i %QUERYFILE% -o %QUERYFILE%.log
goto :EOF
2. In the Execute Process Task, set the Executable to be the this CMD file.
3. Set the argument to be: INSTALL_HOST INSTALL_DB INSTALL_UID INSTALL_PWD QUERYFILE
Please replace each parameter with actual value.
Thanks,
Jin ChenJin Chen - MSFT
Free Windows Admin Tool Kit Click here and download it now
November 11th, 2010 6:44am
Great thanks Jin Chen. It is very nice answer.Helen
November 11th, 2010 5:16pm