2017-04-14 76 views
2

我想通過PowerShell在ISServer上執行SSIS包。 我使用了微軟頁面上找到的腳本。這不適合我。 我想傳遞一個連接字符串,但不能分配給連接管理器,而只是作爲一個變量字符串。在連接字符串中有\;目前和PowerShell將此視爲一種新選擇。我只是希望它被看作是一個完整的字符串。PowerShell DTexec/ISServer將連接字符串作爲包變量傳遞

我用盡了一切辦法,增加"\"\""像一些網站建議,使用instead of \, put double quotes, put ' quotes, nothing works. Always getting the error option的MyServer \ MyServer的;Initial is not valid. I can't remove MyServer的\ MyServer`因爲連接到該實例。

Connectionstring通過變量變量賦值。所以變量包含Data Source=MyServer\Myserver;Initial Catalog=SQL_MyArchive;Provider=SQLNCLI11;Integrated Security=SSPI;

dtexec /ISSERVER "\SSISDB\Test\Test.dtsx" /SERVER "MYServer" /ENVREFERENCE 8 /Par "$Package::ConnectionSource";`""Data Source=MyServer\Myserver;Initial Catalog=SQL_MyArchive;Provider=SQLNCLI11;Integrated Security=SSPI;"`" 

我怎樣才能讓系統看到整個的ConnectionString作爲一個字符串? "" and "「不工作。

回答

0

使用以下語法到的ConnectionString傳遞給一個變量(你錯過了\"

/Par "$Package::ConnectionSource";\""Data Source=MyServer\Myserver;Initial Catalog=SQL_MyArchive;Provider=SQLNCLI11.1;Integrated Security=SSPI;"\"