Posted By

uberdragon on 02/27/11


Tagged

zipcode


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

uberdragon


Pad zipcode field to ensure full 5 digit zipcodes are maintained


 / Published in: MySQL
 

  1. ALTER TABLE `table` CHANGE `zip` `zip` CHAR(5); #changes type
  2. UPDATE table SET `zip`=LPAD(`zip`, 5, '0'); #pads everything

Report this snippet  

You need to login to post a comment.