Quantcast
Channel: Questions in topic: "ssis"
Viewing all articles
Browse latest Browse all 813

SSIS Package Variable Problems

$
0
0
HI, I am trying to set a package variable(Transdate) to the date to pass to a package variable(SQLSource) that will hold my sql query. I plan to use variable SQLSource as the data source for an Oracle OLE DB connection using the evaluate as expression concept. I cannot seem to get my package variable(Transdate) defined as datetime ,to change to the date I want. When I create the package variable Transdate defined as Datetime, it defaults to the current date 08/23/2012. I then call an execute SQL task to manipulate the date using this code: select (Cast(Floor(Cast( DateAdd(Day,-1, GetDate()) as Float)) as Datetime)) In the Execute Sql Task, I have "Result set " = Single row, I have tried 0 as the result name, and assign it to the package variable [User::Transdate] defined as datetime. When I execute the query in sql I get exactly what I need in the format I need: 2012-08-22 00:00:00.000 When I execute the task the Transdate variable[User::Transdate] never changes. So I could continue working for now I hardcoded the Transdate variable[User::Transdate] to 8/22/2012. I put the select sql into the package variable SQLSource using the expression panel like this... Select [ASSET], [BOOK], [COMPANY] , [SEQ_NUMBER], [LEASE_COMPANY] , [LEASE], [ASSET_GROUP], Case When left(trans_Date,4) = '1700' then '1900' + Right(Trans_Date,15) Else Trans_Date End as Trans_Date, [PROCESS_DATE], [REFERENCE], [CREATION_DATE], [CREATION_TIME], [AMTSET9_SS_SW] From Lawson.AMTrans Where CREATION_DATE = @[User::Transdate] When I hit evaluate expresssion I get : Attempt to parse the expression "Select [ASSET], [BOOK], [COMPANY] , [SEQ_NUMBER], [LEASE_COMPANY] , [LEASE], [ASSET_GROUP], Case When left(trans_Date,4) = '1700' then '1900' + Right(Trans_Date,15) Else Trans_Date End as Trans_Date, [PROCESS_DATE], [REFERENCE], [CREATION_DATE], [CREATION_TIME], [AMTSET9_SS_SW] From Lawson.AMTrans Where CREATION_DATE = @[User::Transdate]" failed. 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 a required element such as a parenthesis. I hope you can help! Thanks! paws27284 PS Why does my question look readable in the preview but looks like crap in the actual view? I added spaces and bold to help facilitate reading but it does not show up in the actual view. (or would that be a different question?) :)

Viewing all articles
Browse latest Browse all 813

Trending Articles