View Single Post
  #13 (permalink)  
Old 04-04-08, 14:37
danglauser danglauser is offline
Registered User
 
Join Date: Apr 2008
Posts: 1
Talking Another option, try VARCHAR() instead of CHAR()

For example:

MY_VALUE DECIMAL(9,0)

SELECT CHAR(MY_VALUE)
FROM MY_TABLE

000100045.
100003567.
010555365.


SELECT VARCHAR(MY_VALUE)
FROM MY_TABLE

100045.
100003567.
10555365.

So if you want to trim the leading zeros from your string then use VARCHAR().
If you want to leave the leading zeros (as we do since we are processing SSNs) then use CHAR().

--
Dan Glauser
J2EE Architect
Reply With Quote