Pad zipcode field to ensure full 5 digit zipcodes are maintained


/ Published in: MySQL
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.