3 ms·
Funnily enough I just dealt with this scenario today. I had to fix a database which was storing phone numbers in an int column. The phone numbers start with a 0
by rwky 4y ago
Funnily enough I just dealt with this scenario today. I had to fix a database which was storing phone numbers in an int column. The phone numbers start with a 0 so no surprise querying it didn't work! It's now a string.
- lattalayta 4y agoI saw the same thing once for United States zip codes. I guess they didn't realize that the east coast has zip codes that start with 0s
- at_a_remove 4y agoThen you've got your ZIP+4 format ...
- inopinatus 4y agoThe tendency of spreadsheets, most notably Excel, to convert phone numbers to integers (or worse, a generic number form that it then saves in floating-point representation) has infuriated everyone that ever exported a telephone field. Yes, there are ways to trick Excel into interpreting the value as a string. None of them are foolproof.
- dspillett 4y agoSome years ago we had fun with a client who had systems that insist staff reference numbers are zero-padded, but users like processing data via Excel before uploading for us to import or otherwise process. Even just opening and accidentally saving (habit, accidental change followed by undo with enough time between for auto save to kick in, etc) when intending just to open to inspect, will step the leading zeros off in a CSV. So all code dealing with their manual inputs or bulk imports needs to be aware that those codes may or may not have leading zeros so cannot be used as simple string values as they should be. For extra fun, in one case after a company merge/purchase some codes were padded to a different length so treating them as numbers or unpadded strings internally and padding with zeros for display/export/other wasn't as clear as you'd think.