how to define columns to read decimals like lat and long?

Teradata Studio

how to define columns to read decimals like lat and long?

Hi, this is my first post so bear with me if someone may have already asked this Q.

I am trying to load a flat file that includes fields for latitude and longitude. Each of these has 8 decimals with two or 4 leading characters as shown below:

rooftop_lat : 33.98786545

rooftop_long: -118.2559204

My SQL statements within the Crate table script are as follows:

rooftop_lat  Decimal(8) NULL ,

rooftop_long  Decimal(8) NULL ,

However, after loading my data set - a MS-DOS.csv flat file, what I see in Teradata Studio Sample records are rounded fields as in rooftop_lat = 34 and rooftop_long = -118.

In other words, Teradata Studio is rounding the decimals ot the nearest whole number and not displaying the decimals.

Question: What is correct SQL syntax that displays all the deciamls?

Thanks in advance for your help.

1 REPLY
Senior Apprentice

Re: how to define columns to read decimals like lat and long?

DECIMAL(8) doesn't have any fractional part, you should use 3 digits plus fractional digits, e.g. DEC(11,8) 

Dieter