Remove dot in the result from decimal values in Teradata

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 7

99 formating will give 07

and Z9 formating will also give 7

but ZZ formating of 0 gives two space characters

where as Z9 formating of 0 will give 0

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 http://blog.iguddy.com/