A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Data Type



 
 
Thread Tools Display Modes
  #1  
Old December 16th, 2009, 02:20 AM posted to microsoft.public.access.tablesdbdesign
Steve
external usenet poster
 
Posts: 2,662
Default Data Type

Greetings:

I have numeric data with which I do not need to perform calculations nor do
I need to sort it. Is it better to store this type of data as a number or
text in terms of the efficiency of the database? Thanks for any thoughts on
this.
--
Steve
Ads
  #2  
Old December 16th, 2009, 04:31 AM posted to microsoft.public.access.tablesdbdesign
Ken Snell
external usenet poster
 
Posts: 177
Default Data Type

Number datatype usually occupies less memory space than text, depending on
the number of digits in the number (as the number of digits increases, text
uses more memory while number uses same amount regardless of digit count).
So go with number.

--

Ken Snell
http://www.accessmvp.com/KDSnell/


"Steve" wrote in message
...
Greetings:

I have numeric data with which I do not need to perform calculations nor
do
I need to sort it. Is it better to store this type of data as a number or
text in terms of the efficiency of the database? Thanks for any thoughts
on
this.
--
Steve



  #3  
Old December 16th, 2009, 05:11 PM posted to microsoft.public.access.tablesdbdesign
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Data Type

I disagree with Ken. Some 'numbers', such as Social Security Numbers,
Zipcodes, and even some phone numbers, can start with zeros. If you store
these in a number field, the leading zeros are removed. Then you need to use
code or fancy formatting to reinsert the zeros before use in something like a
mail merge. There goes any efficiency of storing it as a number.

I say that if your aren't doing math on it, it isn't a number.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"Steve" wrote:

Greetings:

I have numeric data with which I do not need to perform calculations nor do
I need to sort it. Is it better to store this type of data as a number or
text in terms of the efficiency of the database? Thanks for any thoughts on
this.
--
Steve

  #4  
Old December 16th, 2009, 05:35 PM posted to microsoft.public.access.tablesdbdesign
Keith Wilby
external usenet poster
 
Posts: 812
Default Data Type

"Jerry Whittle" wrote in message
...

I say that if your aren't doing math on it, it isn't a number.


FWIW I agree and I must say that I thought it was "best practice" too.

Keith.
www.keithwilby.co.uk

  #5  
Old December 16th, 2009, 05:48 PM posted to microsoft.public.access.tablesdbdesign
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Data Type

Steve

Just because you call it a "number" doesn't make it a true number. As
others have pointed out, if you don't need to "do math" on it, it isn't
really a number.

If it isn't really a number, don't 'type' it as a numeric data type. Access
expects different things when using numbers, and handles numbers differently
(see comment in-thread about leading zeros...).

And if you are concerned about "the efficiency" of the database, I don't
believe you'd notice the difference in either performance or storage, using
Text vs. Numeric data types ... unless your database had millions of rows!

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"Steve" wrote in message
...
Greetings:

I have numeric data with which I do not need to perform calculations nor
do
I need to sort it. Is it better to store this type of data as a number or
text in terms of the efficiency of the database? Thanks for any thoughts
on
this.
--
Steve



  #6  
Old December 17th, 2009, 12:08 AM posted to microsoft.public.access.tablesdbdesign
Clifford Bass[_2_]
external usenet poster
 
Posts: 1,295
Default Data Type

Hi Steve,

Here is my take: If it is a number, as in a real number and not
something called a number that may not be a number, then store it as a number
because that will ensure that the data is always numeric. Just because you
are not doing calculations, does not mean that it is not a number. If there
is one thing I hate, it is getting data from sources in Access tables where
they store the numbers in text fields. That makes me check all those values
to make sure they really are numbers.

Explanation on "something called a number that may not be a number":
Telephone "numbers" as they often have extra characters--think especially
international numbers that do not follow your country's format;
company-internal numbers such as 2-3456; and cell-phone shortcuts such as
*123. I like to provide free-form text columns/boxes for those so the user
can enter whatever is necessary. National ID numbers which may use varying
formats and even letters.

If you set up for text columns for true numbers, it makes for a lot
more work to ensure that you only have true numbers in those columns. And
you have to enforce that everywhere that the data may come into your table.
In my opinion this issue far outweighs any minor performance hit in
formatting numbers to include leading zeroes or other types of formats.
Formatting of numbers is a well developed process that I am sure is designed
to be highly efficient. Reading data from disk and over the network is
likely to be slow in comparison to the execution of the formatting code. An
integer is two bytes. To store that same number as a text column you need up
to six bytes (one for the sign and five for the digits). For a long you need
four bytes as a number. To store that in text you need up to eleven bytes.
So storing those as text to can triple the amount of data you have to store,
send and retrieve. In a small database this will not be noticable. In a
large one it will.

Again, my take,

Clifford Bass

"Steve" wrote:

Greetings:

I have numeric data with which I do not need to perform calculations nor do
I need to sort it. Is it better to store this type of data as a number or
text in terms of the efficiency of the database? Thanks for any thoughts on
this.
--
Steve

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:16 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
Copyright 2004-2019 OfficeFrustration.
The comments are property of their posters.