beautypg.com

The datetime conversion option – Sybase 12.4.2 User Manual

Page 232

background image

Converting data on insertion

212

Use any character other than Y, M, J, or D to indicate the separator
character you want Adaptive Server IQ to skip over. You can even use
blanks.

If a

DATE

format includes only a year and a day number within the year,

Adaptive Server IQ treats the date as a Julian date. For example, 1998-33
is the 33rd day in the year 1998, or February 2, 1998.

If a year is specified with only two digits, for example "5/27/32", then
Adaptive Server IQ converts it to 19yy or 20yy, depending on the year and
on the setting of the

NEAREST_CENTURY

option.

For more information, see “Database Options” in the Adaptive Server IQ
Reference Manual
.

The DATETIME conversion option

Use the

DATETIME

conversion option to insert ASCII data that is stored in a

fixed format into a

TIME

or

TIMESTAMP

or

DATETIME

column. This option

converts the ASCII data input to binary and specifies the format of the input
data. (The

DATETIME

format is used internally to interpret the input; it does not

affect the storage or output format of the data.) See the

ASCII

conversion format

for more information.

Note

For compatibility with previous releases, you can specify that a column

contains

DATETIME

data. However, such data is stored internally as the

equivalent format,

TIMESTAMP

.

Here is the syntax:

DATETIME (’

input_date/time_format’)

In this UNIX example, slashes are separators in the date portion of the input
data, and colons are separators in the time portion:

LOAD TABLE lineitem(

NEAREST_CENTURY
setting

Year specified as

Years assumed

Default (50)

00-49

50-99

2000-2049

1950-1999

0

any

1900s

100

any

2000s