Solved

Datatype conversion in SSIS

Posted on 2014-02-03
3
235 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
ID: 39831234
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
ID: 39831260
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
ID: 39831394
Try
Cast(replace([Salary],',','') as int) > cast(20000 as int)

Open in new window

0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Replace Dates in query 14 42
TOOLS - convert T-SQL TO PL/SQL 3 28
SQL Server Insert where not exists 24 43
sql 2008 how to table join 2 17
Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
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.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

825 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