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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|