SSIS Scripting error

I am using SSIS 2012 with VS 2013. I have variable defind as a SQL statement with this where clause. When I run the package I keep getting the message "Incorrect syntax neat the keyword 'And'.". If I evaluate the expression within the project and run it in SSMS it runs just fine. Does anyone see anything wrong with this Where clause? All the variables have defined values.

WHERE YEAR(a.TRXDATE)*10000+MONTH(a.TRXDATE)*100+DAY(a.TRXDATE) >= " + @[User::FiscalPeriod] + (@[User::LoadFuturePer]
== "Y"?";":" And YEAR(a.TRXDATE)*10000+MONTH(a.TRXDATE)*100+DAY(a.TRXDATE) <=  " + @[User::CurrentPeriod] + ";")
LVL 1
rwheeler23Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vikas GargAssociate Principal EngineerCommented:
HI,

I am not getting this == "Y"?";":"

If we are using execute sql task we can pass parameter using ?

But in script task we need to declare a variable and pass the value accordingly
rwheeler23Author Commented:
I have several SSIS packages that use this script. All I do is modify the body of the SQL statement and I have never needed to adjust the Where clause. I have attached the entire statement. Are you saying that I should remove the ?
rwheeler23Author Commented:
By the way, this is a data flow task. I am extracting data out of one database and inserting it into another.
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

Vitor MontalvãoMSSQL Senior EngineerCommented:
If your variable in SSIS package is an empty string then what will happen?
Also, why '=='? Should be only a single '=' or it was a typo?

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rwheeler23Author Commented:
This package was given to me and works in all other cases. I actually rewrote the date range part so if did not need this construct in the where clause. I think this issue is data driven and in this case the condition is causing this portion of the code to be executed.
rwheeler23Author Commented:
Thanks for the tips.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server

From novice to tech pro — start learning today.