Chapter 7 SQL Data Types
281
♦
month No default
♦
day 1 (useful for month fields; for example, May 1992 will be the
date 1992-05-01 00:00)
♦
hour, minute, second, fraction 0
DATE data type [Date and Time]
A calendar date, such as a year, month and day.
DATE
The year can be from the year 0001 to 9999.
For historical reasons, a DATE column can also contain an hour and minute
if the TRUNCATE_DATE_VALUES option is set to OFF. The
TIMESTAMP data type is recommended for anything with hours and
minutes.
The format in which DATE values are retrieved by applications is controlled
by the DATE_FORMAT setting. For example, a date value representing the
19th of July, 2003 may be returned to an application as
2003/07/19, as
Jul 19, 2003, or as one of a number of other possibilities.
The way in which a string is interpreted by the database server as a date is
controlled by the DATE_ORDER option. For example, depending on the
DATE_ORDER setting, a value of
02/05/2002 supplied by an application
for a DATE value may be interpreted in the database as the 2nd of May or
the 5th of February.
A DATE value requires 4 bytes of storage.
♦
SQL/92 Vendor extension.
♦
Sybase Not supported by Adaptive Server Enterprise.
"DATE_FORMAT option" on page 181
"DATE_ORDER option" on page 183
"DATETIME data type" on page 281
"SMALLDATETIME data type" on page 282
"TIMESTAMP data type" on page 283
"TRUNCATE_DATE_VALUES option" on page 214
DATETIME data type [Date and Time]
A domain, implemented as TIMESTAMP.
Function
Syntax
Usage
Standards and
compatibility
See also
Function