Link to home
Start Free TrialLog in
Avatar of rajeshnayakwadi
rajeshnayakwadi

asked on

format decimal to char

hi all,

i am using  the below query to do a fast export in teradata

sel
CAST((b.id  (FORMAT 'zzzzzzzzzzzzv')) AS CHAR(12)),CAST('|'  as char(1)),
from
customer b

here the column id in table has both negative and postive values but the above sql changes all negative numbers to postive. can anyone suggest me how to retain the negative number when i do select ?
sample customer table data
-7045
5678

Avatar of Nick Upson
Nick Upson
Flag of United Kingdom of Great Britain and Northern Ireland image

Sign characters.
May be placed at the beginning or end of a format string. One sign
character places the edit character in a fixed position for the output
string.
If two or more of these characters are present on the left, the sign floats
(moves to the position just to the left of the number as determined by the
stated structure).
The + translates to + or - as appropriate; the - translates to - or blank.
Avatar of rajeshnayakwadi
rajeshnayakwadi

ASKER

Hi Nick,
can you please explain with an example how to preserve the sign ?
ASKER CERTIFIED SOLUTION
Avatar of Nick Upson
Nick Upson
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial