SSIS passing flat file paths as command line parameters

耗尽温柔 提交于 2019-12-12 06:46:02

问题


I have an ssis package that takes two flat files and a database tables as connections. I want to run the ssis package from command line by passing these 3 connections as command line parameters. How should I call?

After some google search I found that if we are using a DB as connection, this is how to pass. But couldn't figure out how to pass connection parameters for flat files.

DTExec.exe /F "<packagepath> /set \package.connections[MyDB].properties[ServerName];SS2K8SV01_Prod

回答1:


Assume I have a flat file connection manager called FFCM and I'd like to update the ConnectionString property to C:\ssisdata\output\B.txt

dtexec.exe 
/file Package2.dtsx 
/set 
\Package.Connections[FFCM].Properties[ConnectionString];C:\ssisdata\input\B.txt

These are case sensitive values so the connection manager must be called FFCM. If there is a ffcm, this wouldn't work.

If you have to deal with spaces in the path, honestly, it's easier to rename the path than to deal with it but I believe the entire argument needs be in double quotes, not just the portion after the semicolon

dtexec.exe 
/file Package2.dtsx 
/set 
\Package.Connections[FFCM].Properties[ConnectionString];C:\ssisdata\input\B.txt
/set 
\Package.Connections[FFCM2].Properties[ConnectionString];C:\ssisdata\input\BC.txt
/set 
\Package.Connections[MyDB].Properties[ServerName];localhost

How do I determine what the thing is after the /set

By default, F4 will bring up the Properties window for whatever you have clicked on in the SSIS editor. Look for the PackagePath property of a given object and that identifies the "base" path.

From there, you will need to access the Expressions collection to identify the property you'd like to set ConnectionString

Thus making the full path we will SET via command line as

\Package.Connections[FFCM].Properties[ConnectionString]


来源:https://stackoverflow.com/questions/50531121/ssis-passing-flat-file-paths-as-command-line-parameters

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!