Float data type export using Fast Export

Tools
Enthusiast

Float data type export using Fast Export

Hello everyone,

I am trying to export a table with float data type using FastExport utility.As we know Teradata rounds-off any float values where number of digit is greater than 15. For instance  1231231231234585.1111 will be stored as 1,231,231,231,234,590.00.

I am using the expression "TRIM(cast((columnNmae(FORMAT '-Z(17)9.99')) as char(100)))"  to  pull the data in the FastExport script but after exporting the data the output comes as "1231231231234585.11" instead of the rounded value stored in table i.e 1,231,231,231,234,590.00

Also if the size of the column is more than 17 in this case the data is getting filtered out.

Can anyone suggest any workaround for this scenario?

Regards,

Indranil Roy

2 REPLIES
Teradata Employee

Re: Float data type export using Fast Export

Hi,

This is not related to FastExport utility. We can see this using BTEQ too.

Is it Okay to use some other data types like decimal?

Here is an example:

 BTEQ -- Enter your SQL request or BTEQ command:

create table t2(c1 decimal(22,4));

create table t2(c1 decimal(22,4));

 *** Table has been created.

 *** Total elapsed time was 1 second.

 BTEQ -- Enter your SQL request or BTEQ command:

ins into t2(1231231231234585.1111);

ins into t2(1231231231234585.1111);

 *** Insert completed. One row added.

 *** Total elapsed time was 1 second.

 BTEQ -- Enter your SQL request or BTEQ command:

sel * from t2;

sel * from t2;

 *** Query completed. One row found. One column returned.

 *** Total elapsed time was 1 second.

                      c1

------------------------

   1231231231234585.1111

 BTEQ -- Enter your SQL request or BTEQ command:

sel (cast((c1(format '-Z(22)Z.ZZ')) as char(100))) from t2;

sel (cast((c1(format '-Z(22)Z.ZZ')) as char(100))) from t2;

 *** Query completed. One row found. One column returned.

 *** Total elapsed time was 1 second.

c1

---------------------------------------------------------------------------

1231231231234585.11

Thanks!

Teradata Employee

Re: Float data type export using Fast Export

FLOAT values are NOT "rounded off to 15 digits", nor is this specifically a Teradata issue.

While some numbers (such as whole numbers with fewer digits) can be represented exactly, floating point values in general should be considered approximations. When converting a number to 64-bit Intel floating point format and back to character, the first 15 or so digits of the stored value should match.

If you want the value rounded, use the ROUND function. If you want to convert to a character string, be sure your FORMAT is large enough to hold the resulting value.