ssis 2008,在表达式生成器上将对象转换为字符串 [英] ssis 2008, convert object to string on Expression Builder
问题描述
我在 Sql server 2008 中使用 SSIS.
im using SSIS for Sql server 2008.
我在 Expression 属性的字符串变量上声明了一个路径:
Im declaring a path on a string variable on the Expression property:
"C:\\data\\Documents\\dt\\local." + @[User::Record] + ".xlsx"
User::Record 是 Object 类型.
The User::Record is of type Object.
我想知道如何将它从 Object 转换为 String 以便我可以在路径上分配它.
I want to know how can I convert it from Object to String so I can assign it on the path.
谢谢..
推荐答案
Expression
在 compile time
求值.所以变量 User::Record 被初始化为 System.Object 类型
.它不包含任何值.
Expression
is evaluated at compile time
.So the variable User::Record is initialized as System.Object type
.It does not contain any value .
不要将其声明为表达式,而是尝试使用 script task
将路径分配给字符串变量.
Instead of declaring it as an expression ,try to use a script task
to assign the path to the string variable .
Dts.Variables["User::Path"].Value =
"C:\\data\\Documents\\dt\\local." + Dts.Variables["User::Record"].Value.ToString() + ".xlsx"
我假设在将路径分配给字符串变量之前,您在 User::Record 变量中存储了一些值.否则即使在上面的脚本任务代码之后,你的路径变量也会保存值
I assume that before assigning the path to the string variable you are storing some value in User::Record variable . Else even after the above script task code ,your path variable will hold the value
C:\data\Documents\dt\local.System.Object.xlsx
这篇关于ssis 2008,在表达式生成器上将对象转换为字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!