23.10.2012 Views

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

Openedge Data Management: SQL Reference - Product ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

• Time literals are in the English language only.<br />

Date literals<br />

Literals<br />

A date literal specifies a day, month, and year using any of the following formats, enclosed in<br />

single quotation marks ( ' ' ). This is the syntax for date literals:<br />

Syntax<br />

{ d ’yyyy-mm-dd’ }<br />

{ d 'yyyy-mm-dd' }<br />

A date literal enclosed in an escape clause is compatible with ODBC. Precede the literal<br />

string with an open brace ( { ) and a lowercase d. End the literal with a close brace )}). If<br />

you use the ODBC escape clause, you must specify the date using the format yyyy-mm-dd.<br />

Note Date literals must be enclosed in single quotations, such as the case with column values in an<br />

INSERT statement.<br />

Examples The following example illustrates how to use the date literal format with an INSERT statement:<br />

INSERT INTO dtest VALUES ( { d '2004-05-07' } )<br />

The INSERT and SELECT statements in the following example show some of the supported<br />

formats for date literals:<br />

CREATE TABLE T2 (C1 DATE, C2 TIME);<br />

INSERT INTO T2 (C1) VALUES('5/7/56');<br />

INSERT INTO T2 (C1) VALUES('7/MAY/1956');<br />

INSERT INTO T2 (C1) VALUES('1956/05/07');<br />

INSERT INTO T2 (C1) VALUES({d '1956-05-07'});<br />

INSERT INTO T2 (C1) VALUES('29-SEP-1952');<br />

SELECT C1 FROM T2;<br />

-------------c1<br />

1956-05-07<br />

1956-05-07<br />

1956-05-07<br />

1956-05-07<br />

1952-09-29<br />

Time literals<br />

Time literals specify an hour, minute, second, and millisecond, using the following format,<br />

enclosed in single quotation marks (' ' ). This is the syntax for time literals:<br />

Syntax<br />

{ hh:mi:ss[:mls ] }<br />

205

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!