Jump to content

Recommended Posts

Zipcodes are not actually numbers. They are formatted strings consisting of numeric digits. As soon as you store them as a number they will loose any leading zeros unless you define them as having leading zeros.

 

What is your column definition?

You must be referencing them as a number at some point, rather than as a string. When you look directly in the database table as the leading zero's present in the data or does this problem show up when you display the values?

 

You can correct the existing data, but until you find at what point during the processing the leading zeros get dropped, any new data will have the same problem.

 

The simplest solution would be to always left pad the string with zero's, either at the point they are inserted or at the point where you display them.

I am looking directly in the table.

 

Not all leading 0s are missing.. The issue is older data the vendor has sent me.. I just need to fix it and I would prefer not needing to manually edit each one.

 

Can I use a regex to match the zip codes that have 4 digits and add the zero?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.