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  dBforums > Database Server Software > MySQL > question on integer field length allocation

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-06-07, 15:43
dessri dessri is offline
Registered User
 
Join Date: Feb 2004
Posts: 12
question on integer field length allocation

I was wondering what is the difference between allocating lenght of 4 for an integer (column) and length of 8? I am just trying to understand the reasoning behind it. Any ideas?

Thanks in advance.
Reply With Quote
  #2 (permalink)  
Old 01-06-07, 16:59
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,534
unfortunately, this is one of those things that you find in mysql that is really confusing to many people

there is no "length" to integer datatypes

INTEGER(4) is the same as INTEGER(11) is the same as INTEGER(937) as far as the range of numbers that it can hold is concerned

the number in parentheses applies only to the number of digits shown by default when the ZEROFILL option is chosen

look it up in the docs for more information
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #3 (permalink)  
Old 01-07-07, 17:19
dessri dessri is offline
Registered User
 
Join Date: Feb 2004
Posts: 12
question on integer field length allocation

Thanks for the clarification. it really helps.

BTW is zero fill is used for banking application (or similar) to fill in zeros to maintain length of fields?
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On