2016-07-25 41 views
0

有一个从oracle表中提取数据并将其推送到sql server的简单任务。带有oracle日期的SSIS表达式生成器

创建的变量保存查询,并在表达式生成器给这个:

 select col1,col2,col3,col4 
     from <schema>.table 
     WHERE closedate between to_date('" + (DT_WSTR,10) @[User::ReportStartDate]+"','YYYY-MM-DD') and to_date('" + (DT_WSTR,10) @[User::ReportEndDate] + "','YYYY-MM-DD') 

    However, when evaluating the expression, it fails with the message: "The expression might contain an invalid token, an incomplete token or an invalid element. It might not be well-formed or might be missing part of the required element such as paranthesis" 

一直在寻找它很长一段时间了,但找不到任何明显的。 我在这里做错了什么?

TIA, 蜂

+0

这真的是完整的表达吗?似乎在开头和结尾缺少双引号。 – onupdatecascade

回答

0

新增开始和结束的报价,从而表达变成
"select col1,col2,col3,col4 from <schema>.table WHERE closedate between to_date('" + (DT_WSTR,10) @[User::ReportStartDate]+"','YYYY-MM-DD') and to_date('" + (DT_WSTR,10) @[User::ReportEndDate] + "','YYYY-MM-DD')"
并没有错误产生有效的字符串进行评估。

+0

完美。非常感谢@Ferdipux。报价有帮助。 – Bee