SSIS 将文件名存储为变量

SSIS Storing File Name as a Variable

我是 SSIS 的新手。就像,不到一个月的 exp 使用它 new.

这是我想要做的:

在 File 文件连接管理器编辑器的 "File name:" 部分,我想用一个变量替换它。即 variable\name_of_file.txt.

在变量部分,我有值的路径。我希望这会根据使用 ssis 包的人而改变。

变量值为"c:\users\john_doe\downloads\"

如何将此变量放入文件名位置中的法定文件连接管理器编辑器步骤?

换句话说,我的变量名是"file_output_path",所以在平面文件连接管理器中,我可以将文件名设置为@file_output_pathtest.txt吗?

编辑#1:

我在文件连接中编辑了表达式值,但我 运行 遇到了一些问题。

以下是我设置所有内容的方式:

这是我收到的错误消息:

SSIS 包

"C:\Users\xxx\Downloads\creating_validation_output\orphaned_plan_services_null_provider\orphaned_plan_services_null_provider\orphaned_plan_services_null_provider.dtsx" starting. Information: 0x4004300A at Data Flow Task, SSIS.Pipeline: Validation phase is beginning. Warning: 0x80049304 at Data Flow Task, SSIS.Pipeline: Warning: Could not open global shared memory to communicate with performance DLL; data flow performance counters are not available. To resolve, run this package as an administrator, or on the system's console. Information: 0x40043006 at Data Flow Task, SSIS.Pipeline: Prepare for Execute phase is beginning. Information: 0x40043007 at Data Flow Task, SSIS.Pipeline: Pre-Execute phase is beginning. Information: 0x402090DC at Data Flow Task, Flat File Destination [14]: The processing of file "C:\Users\xxx\Downloads\creating_validation_output\orphaned_plan_services_null_provider\test.txt\test.txt\test.txt" has started. Warning: 0x80070003 at Data Flow Task, Flat File Destination [14]: The system cannot find the path specified. Error: 0xC020200E at Data Flow Task, Flat File Destination [14]: Cannot open the datafile "C:\Users\xxx\Downloads\creating_validation_output\orphaned_plan_services_null_provider\test.txt\test.txt\test.txt". Error: 0xC004701A at Data Flow Task, SSIS.Pipeline: Flat File Destination failed the pre-execute phase and returned error code 0xC020200E. Information: 0x402090DD at Data Flow Task, Flat File Destination [14]: The processing of file "C:\Users\xxx\Downloads\creating_validation_output\orphaned_plan_services_null_provider\test.txt\test.txt\test.txt" has ended. Information: 0x4004300B at Data Flow Task, SSIS.Pipeline: "Flat File Destination" wrote 0 rows. Information: 0x40043009 at Data Flow Task, SSIS.Pipeline: Cleanup phase is beginning. Task failed: Data Flow Task Warning: 0x80019002 at orphaned_plan_services_null_provider: SSIS Warning Code DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (2) reached the maximum allowed (1); resulting in failure. This occurs when the number of errors reaches the number specified in MaximumErrorCount. Change the MaximumErrorCount or fix the errors. SSIS package "C:\Users\xxx\Downloads\creating_validation_output\orphaned_plan_services_null_provider\orphaned_plan_services_null_provider\orphaned_plan_services_null_provider.dtsx" finished: Failure. The program '[9320] DtsDebugHost.exe: DTS' has exited with code 0 (0x0).

我不明白

\test.txt\test.txt\test.txt

来自.

几乎所有 SSIS 对象都有属性 window。

Select 连接管理器,转到其属性 window,找到表达式条目,然后查找 ConnectionString 实体。您可以在那里连接变量以在 运行-时间创建您的路径。

我想出了解决问题的方法。

如果我尝试将路径放入 1 个变量中,并将文件名放入使用路径变量的表达式中 + 在末尾附加文件名,则会添加奇怪的结尾。

如果我将路径和文件名放入两个单独的变量中,我对此没有任何问题。