Solved

SSIS Expression problem

Posted on 2011-09-26
6
604 Views
Last Modified: 2012-05-12
Hi
I am battling to pass an expression in a variable
in SSIS driving me nuts
i have a simple select statement and one of the fields is s numeric (10.0)
I have a variable in SSIS which i want to use as part of the WHERE clause on this numeric field but i keep getting the following error

>>AND TCMSourceSystemID =" + @[User::TCMSourceSystemID]  + "

"Data Types DT_WSTR and DT_R8" are incompatible for binary operator +

thanks


"
SELECT TCMSourceSystemID, SourceCustID  FROM " + @[User::TargetSchema] + ".TCMStdCustomerMapSourceMULTI
WHERE TCMBusinessDate = '" + @[User::TCMBusinessDate]  + "' AND TCMSourceSystemID =" + @[User::TCMSourceSystemID]  + "
"
0
Comment
Question by:CraigLazar
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:DerZauberer
ID: 36598188
Not sure what's the 100% correct syntax, but i think you should convert your number to a varchar type or something like that ...

... + cast(@[User::TCMSourceSystemID] as nvarchar(50)) ...
0
 
LVL 4

Author Comment

by:CraigLazar
ID: 36598633
Hi,
i cannot as it is numeric in the database, so not sure why i am getting this error
0
 
LVL 5

Expert Comment

by:DerZauberer
ID: 36599266
You are using string concatenation to create your sql-statement, so everything has to be text to be concatenated with the rest of the statement. You can and should convert!
0
How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

 
LVL 21

Accepted Solution

by:
Alpesh Patel earned 250 total points
ID: 36707753
SELECT TCMSourceSystemID, SourceCustID  FROM " + @[User::TargetSchema] + ".TCMStdCustomerMapSourceMULTI
WHERE TCMBusinessDate = '" + @[User::TCMBusinessDate]  + "' AND TCMSourceSystemID = (DT_WSTR,20) " +  @[User::TCMSourceSystemID]  + "
0
 
LVL 4

Author Comment

by:CraigLazar
ID: 36712552
Thanks will give it a try
0
 
LVL 4

Author Closing Comment

by:CraigLazar
ID: 36714633
thanks got it going
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now