×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

SSIS import from CSV is truncating the Decimal

SSIS import from CSV is truncating the Decimal

SSIS import from CSV is truncating the Decimal

(OP)
I'm using Visual Studio Pro 2017 v15.9.11 to create a basic SSIS Package to read data from a CSV File.

In my SQL Table (I am importing INTO) I have a column - [InvAmt] as decimal(19,2)
In my Flat File Connection Manager, (for th eCSV Import file) the column is set :
DataPrecision = 0
DataScale = 2
DataType = decimal [DT_DECIMAL]

A value of 250.72 gets imported as 272.00 truncating the decimal value.

I tried changing the column setting to
DataPrecision = 19
DataScale = 2
DataType = numeric [DT_NUMERIC]

and I get the same result.

Any ideas?

Thanks in Advance.

Chuck

RE: SSIS import from CSV is truncating the Decimal

somewhere along the pipe it is most likely changing from decimal (x,2) to int or decimal (x,0)

you can check that by going to the mapping tab on the dataflow and hoover over the 2 values to see how each column (both db and file) are defined.

and check also on advanced editor properties of the source within the data flow, input and output properties and look at both internal and external colunmns.

this assumes also that you do not have any task between source and destination on your dataflow.

note that sometimes when changing properties on a file connection these are not fully propagated on the dataflows so it is better to remove the source on the data flow and add it again - as well as the destination.

to ensure that it the values are going well up to the destination component add a data viewer between source and destination and ensure that the value is correct at that point - if it is correct and if the destination has indeed the required decimals see if you by any change have a trigger on the table that may be changing the value on inserts.

Regards

Frederico Fonseca
SysSoft Integrated Ltd
www.syssoft-int.com

FAQ219-2884: How Do I Get Great Answers To my Tek-Tips Questions?
FAQ181-2886: How can I maximize my chances of getting an answer?

RE: SSIS import from CSV is truncating the Decimal

(OP)
I believe you were right, that the property change, did not propagate.
I double clicked on the Data Flow Path between my Flat File Source and the OLE DB Destination.
Then Selected "Data Viewer" and enabled it.
I then ran the Package and it it worked fine.
Then the Disabled the data viewer, re-ran again and it is still importing OK.

Thanks for your help.
Chuck

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close