Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2010
    Posts
    2

    Unanswered: Which one to choose from CHAR or DECIMAL

    Hi,

    I am using Db2 v8.x. One of new table has "ID" column which will store 11 digits max. It is an Identifier.
    In version 8.x BIGINT is not supported. Please suggest which one should I prefer BIGINT(19,0) or char(12) store 11 digit value in ID coulmn and why?

  2. #2
    Join Date
    Jul 2009
    Posts
    150

    Lightbulb Varchar(12)

    Quote Originally Posted by tkk View Post
    Hi,

    I am using Db2 v8.x. One of new table has "ID" column which will store 11 digits max. It is an Identifier.
    In version 8.x BIGINT is not supported. Please suggest which one should I prefer BIGINT(19,0) or char(12) store 11 digit value in ID coulmn and why?
    If BIGINT is not supported you have to use Varchar(12), not a char(12)... Also you can use DECIMAL(11, 0).

    Kara+

  3. #3
    Join Date
    Mar 2010
    Posts
    2
    Hi DB2Plus
    Can you please explain which one will fit best Varchar(12) or DECIMAL(11, 0) and WHY ?

  4. #4
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    BIGINT is supported in DB2 V8.x.

    Decimal (11,0) takes up 6 bytes[(n+1)/2 rounded to next highest byte if necessary], and CHAR(11) takes up 11 bytes. BIGINT takes up 8 bytes.

    Varchar has a 2 byte overhead for the actual number of bytes stored, plus the number of bytes (not sure why CHAR cannot be used).
    Last edited by Marcus_A; 03-29-10 at 09:58.
    M. A. Feldman
    IBM Certified DBA on DB2 for Linux, UNIX, and Windows
    IBM Certified DBA on DB2 for z/OS and OS/390

  5. #5
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    V8 (DB2 LUW) is out of service, so the whole product version is "not supported".
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Tags for this Thread

Posting Permissions

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