We help IT Professionals succeed at work.

SSIS: Convert string to decimal

igorlove
igorlove asked
on
6,380 Views
1 Endorsement
Last Modified: 2012-02-16
I have flat data file, where one field is decimal without digit before decimal point like
".876954".  I tried to convert it to decimal (10,6). But I got error when I run SSIS package.
Can you help me.
Comment
Watch Question

Commented:
Add 0 in the string and then try to convert it. By the way what error you are getting?
CERTIFIED EXPERT

Commented:
Could you share the error messaeg, it seems like the way of converstion implementation needs to get checked.

Author

Commented:
When I tried this conversion in sql server management studio through select CAST('.897543' as decimal(10,6)) is it now problem and I got 0.897543. But when I tried to do this in "derived column" in the SSIS package like this (DT_DECIMAL, 6) "0 + Trim( [Column2] )", where column2 data like above ".897543" I got error.

Author

Commented:
The error of dervid column expression ( (DT_DECIMAL, 6)TRIM( [Column2] ) is "An error occurred while attempting to perform a type cast".
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
This very simple and help me resolve my problem,  Thanks
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.