Remove dot (.) in the result from decimal values in Teradata

In Teradata if I export decimal(18,0) values to a file the dot(.) is appended with the values.Example : If the value is 123 in a table then the 123. is stored in a file. to avoid this issue we can useCAST(CAST(SUM(a.amt) AS CHAR(20)) AS DECIMAL(18,0) FORMAT’Z(20)9′) as Amthere amt is a decimal(18,0) value.Z, when used with integer types implies a place holder for a digit, which if there are no digits, could be supplemented with a space. 9, on the other hand will supplement a missing digit with 0so if you do ZZ formating for 7, you get 799 formating will give 07and Z9 formating will also give 7but ZZ formating of 0 gives two space characters

where as Z9 formating of 0 will give 0

If You need more click here


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s