DATE(D|E|I|J|U)
-d D|E|I|J|U - Teradata Preprocessor2

Teradata® Preprocessor2 for Embedded SQL Programmer Guide

Product
Teradata Preprocessor2
Release Number
17.00
Published
June 2020
Language
English (United States)
Last Update
2020-06-19
dita:mapPath
whb1544831946911.ditamap
dita:ditavalPath
obe1474387269547.ditaval
dita:id
B035-2446
lifecycle
previous
Product Category
Teradata Tools and Utilities

Purpose

Specifies the format used at PP2 runtime when a date field is returned to a character field in the application from the database.

Usage Notes

Format Code Description
D Database format (mm/dd/yy)
E EUR format (dd.mm.yyyy)
I ISO format (yyyy-mm-dd)
J JIS format (yyyy-mm-dd)
U USA format (mm/dd/yyyy)

DATE(D) is the default. However, because this code returns only the final two dates in the year, always select one of the other codes to ensure that all four digits of the year are returned.

Specifying Date Format

In obtaining DATE information, PP2 returns the data without changing its form. PP2 does not convert DATE data to the form specified for a column. To convert DATE data to a special form, use a specific SELECT statement.

Using the SELECT Statement to Specify Date Format

To obtain date information in the form yyyy/mm/dd, construct the SELECT statement as follows:

SELECT fieldn (FORMAT ’yyyy/mm/dd’) (CHAR(10)) .  .  .  ;
  • The date column fieldn in this example is of type DATE, but fieldn is returned as character data through the (CHAR(10)) clause, which causes the DATE option to be ignored.
  • The DATE option applies only to DATE data being returned to character variables.
  • The host variable that receives this field must be of character type, with a length of at least 10.
  • The format specified in the SELECT statement overrides the DATE option only for the statement and the field (or fields) which are specified. Use this method to obtain a format other than one available through the DATE option.