Using QMF


Entering date and time values by using QMF

There are some additional considerations when using SQL statements to insert or update date and time values by using QMF. QMF application programs are precompiled with date options and time options of the International Standards Organization (ISO), which represents date as yyyy-mm-dd and time as hh.mm.ss. For more information on using SQL statements to insert or update date and time values, see the QMF Reference, SC26-4716-05.

If you insert a date or time value into a character column using a special register such as CURRENT DATE or CURRENT TIME, the character string representation of the value is in the ISO format.

To insert the value in a format other than ISO, you can use a statement like this:

   INSERT INTO date_table
     SELECT CHAR(CURRENT DATE, EUR)
     FROM any_table
     WHERE any_table.unique_column = 'unique_value'

Where date_table is the name of the table into which you want to insert the current date value, any_table is any table (preferably not one that is subject to changes) with a column that contains unique values, and 'unique_value' is a value of the unique column. In these examples, date_table has one character column, which contains the character representation of a date value.

To insert the default ISO format, you can enter an SQL statement like the following:

   INSERT INTO date_table
     VALUES( CURRENT DATE )

To update a character column with the CURRENT DATE or CURRENT TIME value in a format other than ISO, use a statement such as the following:

   UPDATE date_table
     SET date_column = CHAR(CURRENT DATE, EUR)
     WHERE (clause identifying row to be updated)

(Where date_column is a column of the date type).


[ Top of Page | Previous Page | Next Page | Table of Contents | Index ]