Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2009
    Posts
    5

    Unanswered: problem in date field

    Hi,

    In the databse the date field is define as

    STARTDATE SYSIBM DATE 4 0 Yes
    ENDDATE SYSIBM DATE 4 0 Yes

    but the data coming as input is in mm/dd/yyyy format.

    The date field is always not updated in table. Si it because of this length issue?

  2. #2
    Join Date
    Jan 2003
    Posts
    4,292
    Provided Answers: 5
    Date fields only take up 4 bytes of storage. That is how they are stored. When the information is presented to you it is shown in a format thay you will understand (mm/dd/yyyy). It is not stored that way. DB2 converts it to and from your human readable format to its internal format automatically.

    Why the date field is not always updated is a separate issue. Do you get any error code? If so what is it? Also list your DB2 version and OS.

    Andy

  3. #3
    Join Date
    May 2003
    Location
    USA
    Posts
    5,737
    When inserting date values, it is best to use the ISO format that DB2 will always understand regardless of the territory code of the client or database server you have.

    'YYYY-MM-DD'

    If you want to retreive data in that format, you can use:
    select CHAR(BIRTHDATE, ISO) from employee;
    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
  •