Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2009
    Posts
    153

    Unanswered: 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

  2. #2
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •