SSIS连接表达式问题
我尝试在 SSIS 中使用子包的表达式,但它总是出错,指出找不到 dtsx 文件。我已经复制了资源管理器的路径,它似乎是正确的。
该错误还指出表达式无法写入该属性。我的代码如下。
中的变量
@[User::vRoot] + "\Employees.dtsx" 其中 @[User::vRoot] 是存储在 SQL Any Ideas
Im trying to use an expression to a sub package in SSIS however it always errors out stating that it cannot find the dtsx file. Ive copied the path to explorer and it seems to be correct.
The error also states that expression cannot be written to the property. My code is below.
@[User::vRoot] + "\Employees.dtsx" with @[User::vRoot] being a variable stored in SQL
Any Ideas
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试使用额外的反斜杠来转义表达式中的反斜杠。
在这种情况下,我需要连接文件夹和文件名,我总是这样做。我通常创建两个名为
FolderPath
和FileName
的变量。假设FolderPath包含C:\temp\
(确保它以反斜杠结尾)并且FileName包含员工.dtsx。我将创建第三个名为
FilePath
的变量,并将该变量的 EvaluateAsExpression 属性设置为 true。我将在此变量中设置以下表达式,以便它动态计算该值。希望有帮助。
Try to escape the backslash in the expression using an additional backslash.
In such a scenario where I need to concatenate folder and file name, I always do it this way. I usually create two variables named
FolderPath
andFileName
. Let's assume FolderPath containsC:\temp\
(make sure it ends with a back slash) and FileName containsEmployees.dtsx
.I will create a third variable named
FilePath
and will set the EvaluateAsExpression property of this variable to true. I will set the following expression in this variable so it dynamically evaluates the value.Hope that helps.
反斜杠在这里是一个转义字符,所以如果你想表示一个字面上的反斜杠,那就是“\\”。
我还建议,作为一般规则,不要在字符串连接中硬编码反斜杠,而是使用此方法来考虑第一个变量中潜在的尾部反斜杠:
@[User::vRoot] + (RIGHT(@[User::vRoot ], 1) == "\\" ? "" : "\\") + "Employees.dtsx"
Backslash is an escape character here, so if you want to represent a literal backslash, it's "\\".
I also suggest, as a general rule, instead of hardcoding a backslash in the string concatenation, to use this method to consider potential trailing backslashes in the first variable:
@[User::vRoot] + (RIGHT(@[User::vRoot], 1) == "\\" ? "" : "\\") + "Employees.dtsx"