Tags:


Decimal values in DB2
September 10, 2004 9:26 AM   RSS feed for this thread Subscribe

[DB2/SQLFilter] How do I cast a value of type DECIMAL(19,4) to a VARCHAR so that it has no leading zeroes, and only two digits after the decimal point? CHAR(DECIMAL( x(19,2) )) produces leading zeroes.
posted by Space Coyote to computers & internet (2 comments total)
I'm not sure if its SQL standard - in fact, I suspect it isn't - but many DBs support TRIM():

TRIM(LEADING '0' FROM CHAR(DECIMAL( x(19,2))))
posted by ChasFile at 11:57 AM on September 10, 2004


STRIP(CHAR(DECIMAL(x(19,2))),L,'0')
posted by smackfu at 2:49 PM on September 10, 2004


« Older A friend of mine I know online...   |   Multilingual folks: I need yo... Newer »
This thread is closed to new comments.