Saturday, November 24, 2007

DB2 datatype - DATE

Date is a three part value (year , month and day)designating a point in time using the Gregorian calendar.
Year - 0001 to 9999
Month - 1 to 12
Date - 1 to 28 / 31/ 30 depending on the month

The internal represenation of date is a string of 4 bytes. Each byte consists of two packed decimal digits.
1st 2 bytes represent the year
3rd byte represents the month
4th byte represents the date

The length of a DATE column as described in the catalog is the internal length (4 bytes). The length of a DATE column as described in the SQLDA is the external length, which is 10 bytes unless a date-exit routine was specified when your DB2 system is installed. In that case, the string format of a date can be up to 255 bytes in length. Accordingly DCLGEN defines fixed-length string variables for DATE columns with a length equal to the value of the field LOCAL DATE LENGTH on installation panel DSNTIP4 or a length of 10- bytes if a value for the field was not specified

No comments: