Decimal values in DB2
September 10, 2004 9:26 AM   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 answers 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 Customizable Sites   |   How do you say "thirty one" in other languages? Newer »
This thread is closed to new comments.