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 > DB2 > Data Type Length

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-08-09, 03:06
ratheeshknair ratheeshknair is offline
Registered User
 
Join Date: Jan 2009
Posts: 153
Data Type Length

Hi Experts,

What is the length of datatypes in DB2 9.5.

Why i am asking is i set integer for one column and its showing 4 as length where i am able to insert a 6 digit number in that.

Please help

TIA
Reply With Quote
  #2 (permalink)  
Old 07-08-09, 03:25
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
You are confusing the way that DB2 stores data internally with how many digits it can hold:

Smallint, 2 bytes internally, can hold up to 32,767.
Integer, 4 bytes internally, can hold up to 2,147,483,647.
Bigint, 8 bytes internally can hold up to 9,223,372,036,854,775,807.

The internal length of a decimal is (n+1)/2 where n is total precision defined.

Date is 4 bytes internally, but returned as 10 bytes (YYYY-MM-DD).
Timestamp is 10 bytes internally, but returned as 26 bytes
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
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