Hi there,I'm using SSIS and I'm entering a sql command in a datareader source. I want to get the data for date and date+1 I have a variable in my package @[User::date] how do I write the below command in there ?
You cannot do it directly. For that you need to use "Expressions" property of the Data Flow Task.
-> Click the Data Flow Task
-> In the properties section, click the ellipsis (…) button against the Expressions
-> An Expression Editor will be prompted
-> Select [DataReader Source].[SqlComamnd] property from the drop down
-> Put the above query as the expression
Since it would need a string type as the expression to execute, and you are dealing with date, you need to use double quotes / quotes to make it work
So the query to be put as expression would be something like
You may or may not face some date-time conversion issue. For that you are always welcome to seek the resolution on this same thread.
answered May 24, 2012 at 09:44 AM
If your date string is a string variable then you can use the following as is:
"SELECT sum (a.1) aa , sum (a.2) bb , sum (a.3) cc , a.4 , a.date data FROM table WHERE date in ((DATEADD(day,+1,"+@[User::date]+"),(DATEADD(day,+2,"+@[User::date]+")) and a.4 = 3 Group By date, a.4 "You do not need double quotes or single quotes around day. If you have any more problems just post.
answered May 28, 2012 at 07:57 AM
Thanks. I changed the date format and it worked.
answered May 30, 2012 at 11:56 AM