Solved

SSIS Expression problem

Posted on 2011-09-26
6
619 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
NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

 
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

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Using examples as well as descriptions, and references to Books Online, show the documentation available for date manipulation functions and by using a select few of these functions, show how date based data can be manipulated with these functions.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

911 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

20 Experts available now in Live!

Get 1:1 Help Now