Background: I have .sql script file of a sql job that incudes a powershell task step. This powershell job step uses sql agent tokens like this -
$sqlInstance = "(ESCAPE_DQUOTE(SRVR))"
$sql_conn = New-Object system.Data.SqlClient.SqlConnection
$sql_conn.ConnectionString = "Data Source=$sqlInstance;Integrated Security=true;Initial Catalog=mydb;"
$sql_conn.Open()
$cmd = new-Object System.Data.SqlClient.SqlCommand
I developed an ssis package using Executescript task to run it in a loop across multiple sql instances to deploy the job. SSIS has a bug when the powerhsell script step uses sql agent tokens. More on that bug in a different post. But for now I need to find a workaround.
My question: I have need to invoke ExecuteProcess task in SSIS as a workaround like this - sqlcmd -S myServer\instanceName -i C:\myScript.sql
How do I pass the parameters _s and -i
I am using SQL Server 2008 R2 Enterprise Edition on Windows 2008 X64 server