我在SSIS包中有3个变量,如以下
NAME TYPE VALUE
FROMDATE String '5/1/2011'
TODATE String Select (FunctionPreviousBusinessDay(),112)
OUTPUT String Select companyName , price from Mytable where date in between '+ @[User::FROMDATE] + "and" + @[User::TODate]'
OUTPUT给我评估的表达式如下:
Select companyName , price from Mytable where date in between '5/1/2011' and
Select (FunctionPreviousBusinessDay(),112)
而不是执行变量TODATE
直接给出字符串。
我期待输出如下
Select companyName , price from Mytable where date in between '5/1/2011' and
'5/22/2011'
我该怎么做?请指教?
使用?
直接粘贴sql查询
但得到以下错误:
Error at Data Flow Task [OLE DB Source [1]]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80004005.
An OLE DB record is available. Source: "Microsoft SQL Server Native Client 10.0" Hresult: 0x80004005 Description: "Syntax error, permission violation, or other nonspecific error".
答案 0 :(得分:1)
我认为您需要一个带有单行结果集的额外执行SQL任务。任务的查询将是
Select (FunctionPreviousBusinessDay(),112)
其结果需要设置为@TODATE。