Removing leading zeros using sql

Update statement to remove leading (or) trailing zeros from a column. The column is a varchar field and the number of zeros vary.



TRAILING CHAR Example

UPDATE TABLENAME SET COLUMNNAME=RTRIM(COLUMNNAME,'.0');




LEADING CHAR Example

UPDATE TABLENAME SET COLUMNNAME=LTRIM(COLUMNNAME,'.0');

No comments:

Post a Comment