Author Message
cheapbag214s
PostPosted: Wed 0:29, 14 Aug 2013    Post subject: Is it a good idea to use an integer column for sto

Could it be smart to use an integer column for storing US ZIP codes inside a database
Both would satisfy the requirements of the data, if we assume that there aren't any international concerns. In the past we've generally just gone the text route, but I wondered if anyone does the opposite? Just from brief comparison it looks such as the integer method has two clear advantages:
It is,Roger vivier uk, by means of its nature,Roger vivier uk, automatically restricted to numerics only (whereas without validation the written text style could store letters and such which aren't, to my knowledge, ever valid inside a ZIP code). It doesn't mean we could/would/should forgo validating user input as normal, though!
Also, it seems like it wouldn't hurt display output much. It's trivial to slap a ToString() on the numeric value,giuseppe zanotti shoes, use simple string manipulation to insert a hyphen or space or whatever for that +4 extension, and employ string formatting to restore leading zeroes.
Is there something that would discourage using int as a datatype for US-only ZIP codes?
Numbers should mean something numeric. ZIP codes don't add or subtract or participate in any numeric operations. 12309 - 12345 does not compute the distance from downtown Schenectady to my neighborhood,giuseppe zanotti shoes sale.
Granted, for ZIP codes, we're not confused. However,giuseppe zanotti, for other number-like fields, it may be confusing.
Since ZIP codes aren't numbers -- they just happen to be coded having a restricted alphabet -- I suggest avoiding a numeric field. The 1-byte saving isn't worth much. And i believe that that meaning is more important compared to byte.
Plus the leading-zero issue means you not storing the client real data,giuseppe zanotti outlet, you storing some adjusted version from it that will need mental gymnastics to consider you have to look out for too-short codes. And let's say they included the +4?
There no benefit to storing them in numeric format that I can see. The only real operation I ever done on zip codes is by using them in long/lat calculations which requires you to treat them like strings anyway: you just grab the first 3 characters (leading zero problem again). Tom May 21 '09 at 15:43
Normally you would employ a non-numerical datatype like a varchar which may permit more zip code types. If you're dead set on only allowing 5 digit [XXXXX] or 9 digit [XXXXX-XXXX] zip codes, you can then make use of a char(5) or char(10), but I would not recommend it. Varchar may be the safest and many sane choice.
Edit: It should be also noted that if you do not intend on doing numerical calculations about the field,giuseppe zanotti sandals, you shouldn't use a numerical data type. ZIP Code is a not really a number in the sense that you simply add or subtract against it. It is just a string that happens to be made up typically of numbers, which means you should avoid using numerical data types for this.
From the technical standpoint,roger vivier sandals, some things raised here are fairly trivial. Sometimes with address data cleansing every day - particularly cleansing address data all over the world. It's not a trivial task by any stretch from the imagination. With regards to zip codes, you could store them as an integer even though it may not be "semantically" correct. The fact is, the data is of a numeric form whether, strictly speaking it is considered numeric in value.
It is also very hard to force the user to input correct data if a person from the repercussions is a delay of economic. Users often not have the patience to go in correct data whether it's not immediately obvious. Using a regex is an excellent method of guaranteeing correct data, however if the user enters a value that doesn't conform and they're displayed an error, they may just omit this value altogether or enter something which conforms but is otherwise incorrect. An example [using Canadian postal codes] is you often see A0A 0A0 entered which isn't valid but conforms to the regex for Canadian postal codes. More often than not,roger vivier pumps, this really is entered by users who are forced to give a postal code, however they either have no idea what it's or do not have everything correct.
One suggestion is to validate the whole of the entry like a unit validating the zip code is correct when compared with all of those other address. If it's incorrect, then offering alternate valid zip codes for the address will make it more convenient for these phones input valid data. Likewise, when the zip code is correct for that street address,roger vivier sale, but the street number falls outside the domain of that zipcode, then offer alternate street numbers for that zip code/street combination.
相关的主题文章:


http://www.luntacunt.fora.pl/tips-tricks,8/innovation-and-a-diversified-approach-typifies-tim,7470.html#7734

http://www.portfolk.fora.pl/koncerty,1/in-a-while-spun1,1802.html#2254

http://www.fingerlog.com/index.php?do=/user/login/

http://atarimae.jp/blog/027/2009/12/post-12.html#comments

http://0403pjm.bbspace.org/viewthread.php?tid=15995&extra=page%3D1&frombbs=1

http://blogs.princeton.edu/pia/personal/xinjiang/2009/06/bureaucracy.html#comments

http://www.compazinegtccv.fora.pl/what-say-watery-smile-work-during-quiet-breath-ambien-strengths-loove-you-iscouraged,1/buying-few-toms-boots-is-ordinarily-getting-a-pair,2778.html#2802

http://development.compuphonic.co.uk/index.php?do=/user/login/

http://atarimae.jp/blog/027/2009/12/post-11.html#comments

http://nlp.edu.vn/showthread.php?114573-Getting-to-know-more-about-Women-s-Boat-shoes-spun5&p=121880#post121880

http://planetlivechat.com/chatcommunity/subscribe/

http://forum.zeload.com/viewtopic.php?f=30&t=557048

http://www.museyon.com/forum/viewtopic.php?f=2&t=528254

http://www.sportsprimetime.net/forums/showthread.php?p=1107113#post1107113

http://www.nifedipinerbzzp.fora.pl/most-often-metformin-hci-1000-mg-augmentin-generic-equipment,1/best-ski-resorts-on-the-u-spun4,10047.html#10295

Powered by phpBB © 2001, 2005 phpBB Group