Friday, February 17, 2012

data type chose

I'd like your opinion or what Microsoft's position is on the following.
In MS Access you'll read a Tip that on phone numbers and other numbers you
don't intend to use for mathematical calculations to use a Text data type.
This may be because the system converts all compares to ascii string...this
isn't an actual reason given.
I read in various SQL Server books, magazines, etc to use the data type
appropriate to the data being stored. So if you have data that is all
numeric, it would seem a numerical type of data type should be used.
Should data not used for calculations be in character data types or are
numerical data types perfectly fine to use?
TIA,
Doug
Doug wrote:
> I'd like your opinion or what Microsoft's position is on the
> following.
> In MS Access you'll read a Tip that on phone numbers and other
> numbers you don't intend to use for mathematical calculations to use
> a Text data type. This may be because the system converts all
> compares to ascii string...this isn't an actual reason given.
> I read in various SQL Server books, magazines, etc to use the data
> type appropriate to the data being stored. So if you have data that
> is all numeric, it would seem a numerical type of data type should be
> used.
> Should data not used for calculations be in character data types or
> are numerical data types perfectly fine to use?
> TIA,
> Doug
I would say that a phone number is not a number at all despite is
having, most time, only a numeric component. Personally, I would never
store a phone number in anything other than a character type column. I'm
not sure what types of mathematical calculations you are going to do on
a phone number. You may have an app that uses the earea code and
exchange for specific processing and in that case, you may choose to
store your phone numbers as AreaCode, Exchange, Suffix. You could also
add country codes, extensions and all sorts of data that describes a
phone number. And you might remember the days when New Yorkers used
letters to tell others their phone numbers "KL6- 2133". Unless, you're
storing a number (value, amount, etc.) I would stick with character
columns.
David Gugick
Imceda Software
www.imceda.com

No comments:

Post a Comment