[KLUG Programming] questions on picking data types
Rusty Yonkers
therustycook at yahoo.com
Thu Jul 15 07:26:59 EDT 2004
> I'd just store it as a string. Since a SSN isn't really a number,
> even
> though it is composed of all digits. Otherwise you will have
> problems
> with SSN's that *START* with a zero (an INT field will obviously
> drop
> it). Like a phone number isn't a number. And while you may store
> SSN,
> how often do you ever actually look someone up using SSN?
We will actually need to look people up by SSN. We do not need to
sort by SSN though I don't think. I wonder if I use the string that
I could put three fields on the form and constrain them for the
appropriate number of characters and then concatenate them into the
field on the write of the data? I am just worried that I am going to
get one that is typed in as 123456789 and another 123-45-6789 and
another 123-456789 and a forth 12-34-56789. There are way to many
permutations for efficient error trapping I think... well unless I
strip out all hyphens and then re-input them as needed. I think I
would want to store the hyphens so that once I capture the SSN I do
not have to continually write code to format the number properly
every time I need to display it in a form or report.
>
> > The only gotcha with doing all 9 digits in one INT is that if you
> > need to parse it with hyphens, you'll have to do that in your
> > input and/or output code. But that's where you should be doing
> > that anyway. Far as I'm concerned, all that cruft, adding
> hyphens
> > for the most common representation of SSN, or parens or hyphens
> or
> > periods or whatever to the 14 most common ways to write a phone
> > number, is all I/O handling. You shouldn't design your DB schema
> > based on whether "(123) 456-7890" or "123.456.7890" is preferred
> > this week or in this country, and the same goes for
> "123-45-6789".
>
> Agree, for phone numbers, etc... it is best to just store the
> actual
> data parts, and drop all the .-() crap.
>
> Also don't forget that *USA* phone numbers are XXX-XXX-XXXX,
> foreign
> phone numbers are not.
>
> _______________________________________________
> Programming mailing list
> Programming at kalamazoolinux.org
> http://www.kalamazoolinux.org/mailman/listinfo/programming
>
=====
Russell C. Yonkers Jr.
CNE, MCP, A+, CCNA, Linux+, Server+, Network+ certified
-----------------------------------------
Currently using SuSE 9, Mac OS X, Windows 2000, and WinXP
And yes I run a network at home with Linux and Windows servers
See my personal website http://www.geocities.com/therustycook
Or my consulting site at http://www.atomicsupergeek.com
__________________________________
Do you Yahoo!?
Read only the mail you want - Yahoo! Mail SpamGuard.
http://promotions.yahoo.com/new_mail
More information about the Programming
mailing list