SQL/MX 2.x Reference Manual (G06.24+, H06.03+)

Introduction
HP NonStop SQL/MX Reference Manual523725-004
1-25
Selecting or Changing Data
Selecting or Changing Data
To select or change SQL/MP data that does not directly map to SQL/MX data types
and literals, you can use special extensions of NonStop SQL/MX with some
restrictions.
DATETIME Data
The SQL/MP DATETIME data type is specified:
DATETIME [start-field TO] end-field
The start-field and end-field specify a range of logically contiguous fields:
YEAR
MONTH
DAY
HOUR
MINUTE
SECOND
FRACTION [(precision)]
The start-field must precede the end-field. The FRACTION field can include
the precision option only if the FRACTION field is the end-field.
Standard DATETIME Data Types
Certain DATETIME data types map directly to the ANSI standard types—DATE, TIME,
and TIMESTAMP. You can retrieve the same value as stored in an SQL/MP column
with these data types or store a value with a standard type into these SQL/MP columns
without truncation or extension.
For more information, see:
SQL/MP Considerations for Datetime Data Types Not Equivalent to DATE, TIME,
TIMESTAMP on page 6-25
SQL/MP Considerations for Datetime Data Types Equivalent to DATE, TIME,
TIMESTAMP on page 6-27
Truncation and Extension
If you attempt to insert a larger DATETIME value into a smaller DATETIME column,
NonStop SQL/MX implicitly truncates the value only on the fractional part. In all other
cases, NonStop SQL/MX returns an error. If you attempt to insert a smaller DATETIME
value into a larger DATETIME column, NonStop SQL/MX returns an error.
This ANSI
standard data
type: is equivalent to this SQL/MP data type:
DATE DATETIME YEAR TO DAY
TIME DATETIME HOUR TO SECOND
TIMESTAMP DATETIME YEAR TO SECOND