Solved

SSIS Expression problem

Posted on 2011-09-26
6
633 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSIS with VPN COnnection 2 77
SQL Server 2012 r2 - Varible Table 3 24
Whats wrong in this query - Select * from tableA,tableA 11 31
Passing Parameter to Stored Procedure 4 24
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

773 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