Showing posts with label loosing. Show all posts
Showing posts with label loosing. Show all posts

Monday, March 19, 2012

Importing Decimal Data Types into SQL Server 2005

I have a simple Integration Services project and the problem is that decimal fields are importing as real (I'm loosing the digits behind the decimal point).

The project contains a data flow task importing a flat file (.csv) to an SQL Server destination. My .csv file has two decimal type fields. Example:

Field 1: 12345.67

Field 2: .123456

My database table that I'm importing to has two fields. The only way that I can get this data to import is to define the fields as "float" in both the text file and database table. I want the database table fields to be defined as decimal or numeric, not float:

Field 1: decimal(7,2)

Field 2: decimal(6,6)

When all fields are defined as decimal (in both the flat file and database file), I get the following results:

Field 1: 12345.00

Field 2: .000000

How does one import decimal data from a flat file (.csv)?

Thank you in advance!

I answered my own question. My eyes were just not seeing the DataScale property of the Advanced connection manager editor window. Once I plugged in the scale value my decimals imported perfectly.

jn

Friday, March 9, 2012

Importing data from oracle to sql loosing data after the decimal point

I have created a simple package that uses a sql command to pull data from an oracle database and inserts the data into a sql 2005 table. Some of the data fields that i am pulling from contain two digits after the decimal point, however this data is lost when it gets into sql. I have even tried putting the data into a flat file, and still the data is lost.

In the package I have a ole db source connection which is the oracle database and when i do the preview i see all the data I need. I am very confused and tried a number of things to get the data into sql, but none work. Any ideas would be very helpful.

thanks

What is the data type of the SSIS column that you are storing the Oracle results in? Also double check that you have a "scale" defined for that data type.|||

I have tried money, decimal (38,2) , float and numeric (18,2)

With no luck. What is really weird is that when I use the Destination of flat file the same thing happens I loose all digits after the decimal.

|||Are you just going source to destination? No other transformations?|||thats correct.|||Do you receive any truncation warnings when you run the package? (Or ANY warnings?)|||

I don't get any warnings if I use numeric (38,2)

I let the package create the table. The package wants to use numeric (38) but I changed to numeric (38,2) on the create table statement in the destination window.