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 > problem in date field

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-16-09, 07:57
db2id db2id is offline
Registered User
 
Join Date: Apr 2009
Posts: 5
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?
Reply With Quote
  #2 (permalink)  
Old 04-16-09, 08:10
ARWinner ARWinner is offline
Registered User
 
Join Date: Jan 2003
Posts: 3,575
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
Reply With Quote
  #3 (permalink)  
Old 04-17-09, 03:56
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
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
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