• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 752
  • Last Modified:

SSIS Expression problem

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
CraigLazar
Asked:
CraigLazar
  • 3
  • 2
1 Solution
 
DerZaubererCommented:
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
 
CraigLazarAuthor Commented:
Hi,
i cannot as it is numeric in the database, so not sure why i am getting this error
0
 
DerZaubererCommented:
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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
Alpesh PatelAssistant ConsultantCommented:
SELECT TCMSourceSystemID, SourceCustID  FROM " + @[User::TargetSchema] + ".TCMStdCustomerMapSourceMULTI
WHERE TCMBusinessDate = '" + @[User::TCMBusinessDate]  + "' AND TCMSourceSystemID = (DT_WSTR,20) " +  @[User::TCMSourceSystemID]  + "
0
 
CraigLazarAuthor Commented:
Thanks will give it a try
0
 
CraigLazarAuthor Commented:
thanks got it going
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now