Solved

Datatype conversion in SSIS

Posted on 2014-02-03
3
231 Views
Last Modified: 2016-02-10
Hi,

   I am trying to convert a salary field (coming from a comma delimited txt file) into an int so that I can compare it to 20000 in a SSIS conditional split condition.
What I do in the conditional split is this:
Cast([Salary] as int) > cast(20000 as int)

However, I keep getting this error in the attatchment. How can i convert my text field Salary to an int and then compare to 20K?

thx
0
Comment
Question by:LuckyLucks
3 Comments
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
Comment Utility
No attachment.

>How can i convert my text field Salary to an int
Derived Column task, create a new column,
   Derived Column = Replace 'the text column name'.
   Expression of (DT_I4) [the text column name].  
Then in downstream Conditional Split use the new column.
0
 
LVL 25

Expert Comment

by:jogos
Comment Utility
Error in attachement?

You must see that all input-record have valid input.  The IsNumeric()-function can be usefull to filter the invallid records out first. What to do with the others depends on your process: neglect with or without (I hope not) error, putting dummy 0 in the place ...
0
 
LVL 10

Expert Comment

by:HuaMinChen
Comment Utility
Try
Cast(replace([Salary],',','') as int) > cast(20000 as int)

Open in new window

0

Featured Post

Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

Join & Write a Comment

Here's a requirements document template for an integration project (also known as Extract-Transform-Load or ETL) based on my development experience as an SQL Server Information Services (SSIS) developer over the years.
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

772 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

11 Experts available now in Live!

Get 1:1 Help Now