Log in

View Full Version : Data Type for Zip Code ?



JasonDFR
02-25-2009, 08:56 AM
Char 5

Varchar 5

Int 5

I don't care about the ZIP + 4.

I think Char 5 is best, but I'd like conformation / suggestions.

Thanks.

codeexploiter
02-25-2009, 09:19 AM
Use varchar if the field can be empty.

If the zipcode is a mandatory field then I don't think there is any difference between char and varchar as the field is going to have some value whose min and max length will be 5.

boogyman
02-25-2009, 02:47 PM
min and max length will be 5.

provided it's only used by USA users; If the zip/post code field is for use in other parts of the world, I would suggest you make it a non-required field, as there are some "states" that do not have postal codes.