Considerations For Date Formats; Considerations For Other Formats; Examples Of Format - HP Neoview SQL Reference Manual

Hide thumbs Also See for Neoview SQL:
Table of Contents

Advertisement

-99:99:99:99
specifies that the FORMAT clause output format is a timestamp. The input must be a numeric
value.

Considerations for Date Formats

The expression preceding the (FORMAT "format-string') clause must be a DATE value.
The expression preceding the (DATE, FORMAT 'format-string') clause must be a quoted
string in the USA, EUROPEAN, or DEFAULT date format.

Considerations for Other Formats

For XXX, the expression preceding the (FORMAT 'format-string') clause must be a numeric
value or a string value.
For 99:99:99:99 and -99:99:99:99, the expression preceding the (FORMAT 'format-string')
clause must be a numeric value.

Examples of FORMAT

The format string 'XXX' in this example will yield a sample result of abc:
SELECT 'abcde' (FORMAT 'XXX') FROM (VALUES(1)) t;
The format string 'YYYY-MM_DD' in this example will yield a sample result of 2008-07-17.
SELECT CAST('2008-07-17' AS DATE) (FORMAT 'YYYY-MM-DD') FROM (VALUES(1)) t;
The format string 'MM/DD/YYYY' in this example will yield a sample result of 07/17/2008.
SELECT '2008-07-17' (DATE, FORMAT 'MM/DD/YYYY') FROM (VALUES(1)) t;
The format string 'YY/MM/DD' in this example will yield a sample result of 08/07/17.
SELECT '2008-07-17'(DATE, FORMAT 'YY/MM/DD') FROM (VALUES(1)) t;
The format string 'YYYY/MM/DD' in this example will yield a sample result of 2008/07/17.
SELECT '2008-07-17' (DATE, FORMAT 'YYYY/MM/DD') FROM (VALUES(1)) t;
The format string 'YYYYMMDD' in this example will yield a sample result of 20080717.
SELECT '2008-07-17' (DATE, FORMAT 'YYYYMMDD') FROM (VALUES(1)) t;
The format string 'DD.MM.YYYY' in this example will yield a sample result of 17.07.2008.
SELECT '2008-07-17' (DATE, FORMAT 'DD.MM.YYYY') FROM (VALUES(1)) t;
The format string 'DD-MMM-YYYY' in this example will yield a sample result of 17–JUL-2008.
SELECT '2008-07-17' (DATE, FORMAT 'DD-MMM-YYYY') FROM (VALUES(1)) t;
The format string '99:99:99:99' in this example will yield a sample result of 12:34:56:78.
SELECT 12345678 (FORMAT '99:99:99:99') FROM (VALUES(1)) t;
The format string '-99:99:99:99' in this example will yield a sample result of -12:34:56:78.
SELECT (-12345678) (FORMAT '-99:99:99:99') FROM (VALUES(1)) t;
FORMAT Clause
317

Advertisement

Table of Contents
loading

Table of Contents