0

I have 3 variables like following in SSIS package

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 is giving me evaluated expression like :

Select companyName , price from Mytable where date in between '5/1/2011' and
Select (FunctionPreviousBusinessDay(),112)

Instead of execution of variable TODATE directly giving string.

I'm expecting output like following

Select companyName , price from Mytable where date in between '5/1/2011' and
'5/22/2011'

How can i do this ? please advice ?

Directly paste sql query with ? but getting following error :

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".
2

1 Answer 1

1

I think you need an additional Execute SQL task with a single row result set. The task's query would be

 Select (FunctionPreviousBusinessDay(),112)

And its result would need to be set to @TODATE.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.