SSISDB 包出错,说变量不存在

SSISDB package errs out, says variable does not exist

我有一个 SSIS 包,它从数据库中写入 csv 文件,将它们复制到几个位置,然后通过电子邮件发送一条成功消息。过程是:

  1. 从数据库中检索 public 文件位置到变量中,@[User::varSQLCSVOutputFolder]
  2. 遍历数据库记录列表:
    • 为每个创建一个本地 CSV。
    • 将本地文件复制到@[User::varSQLCSVOutputFolder]
    • 中的位置
  3. 使用@[User:varEmailBody] 中定义的 MessageSource 发送电子邮件。
@[User::varEmailBody] = "Files successfully saved to " + @[User::varCNNTargetCSVFolder]

@[User::varCNNTargetCSVFolder] = @[User::varSQLCSVOutputFolder]

@[User::varSQLCSVOutputFolder]从数据库加载,值=\server.domain.com\TEST\Output Files AM

(确认一下,@[User::varCNNTargetCSVFolder]只是一个传递)

我可以确认表达式在设计时流过。但是当我从 SSISDB 执行它时,我得到了错误

Error: An error occurred with the following error message:

Failed to lock variable "Files successfully saved to
\server.domain.com\TEST\Output Files AM"  for read access with error
0xC0010001 The variable cannot be found.  This occurs when an attempt
is made to retrieve a variable from the  Variables collection on a
container during execution of the package, and  the variable is not
there.  The variable name may have changed or the variable is not
being created.

我认为转义反斜杠可能是一个奇怪的问题,但我尝试在表达式中使用 REPLACE(),但没有成功。我确实反复使用基础变量 @[User::varSQLCSVOutputFolder],但我设置了先例约束,所以应该没有重叠....还有其他可能性吗? 它似乎正在读取我的变量的内容作为变量的名称。

好的,这很有趣。因此,我为 MessageSource 定义了一个表达式,但是,我选择了 MessageSourceType 作为变量,而不是直接输入。后代见下文。