0

我在 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".
4

1 回答 1

1

我认为您需要一个带有单行结果集的附加执行 SQL 任务。任务的查询将是

 Select (FunctionPreviousBusinessDay(),112)

其结果需要设置为@TODATE。

于 2013-05-22T14:50:00.423 回答