Error saving a Decimal value as Varchar Datatype

Database
The Teradata Database channel includes discussions around advanced Teradata features such as high-performance parallel database technology, the optimizer, mixed workload management solutions, and other related technologies.
Visitor

Error saving a Decimal value as Varchar Datatype

Hello - 

 

I am running into an issue where a column in set as Varchar datatype, and while I insert a decimal value the value is getting altered.

 

Below is an example -

 

Actual value = 0.11

 

After the insert statement gets executed, new value = 1.10000000

 

Can someone help me understand if there is any internal conversion that is causing this issue?

 

Thanks much!

 

 

1 REPLY
Apprentice

Re: Error saving a Decimal value as Varchar Datatype

Hi,

This is controlled by the data type of your numeric/decimal column.

 

I'm guessing it is defined with 8 digits after the decimal point, e.g.  DECIMAL(12,8)

 

If you don't specifically format the value before the insert into VARCHAR then TD will use the default format for that column/data type.

 

Cheers,

Dave

Ward Analytics Ltd - information in motion
www: http://www.ward-analytics.com