Character Strings that Omit Hour, Minute, or Second - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
ft:locale
en-US
ft:lastEdition
2024-12-11
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

If the character string in a character-to-TIME conversion omits the hour, minute, or second, the system uses default values for the target TIME value.

Omitted Target TIME Value
Hour 0
Minute
Second

Consider the following table:

CREATE TABLE time_log
   (id INTEGER 
   ,start_time TIME 
   ,end_time TIME
   ,log_time TIME);

The following INSERT statement converts three character strings to TIME values. The first character string omits the hour, the second character string omits the minute, and the third character string omits the second.

INSERT time_log
   (1001
   ,CAST ('01:02.030405' AS TIME FORMAT 'MI:SS.S(6)')
   ,CAST ('01:02.030405' AS TIME FORMAT 'HH:SS.S(6)')
   ,CAST ('01:02' AS TIME FORMAT 'HH:MI'));

The result of the INSERT statement is as follows:

SELECT * FROM time_log;
         id       start_time         end_time         log_time
-----------  ---------------  ---------------  ---------------
       1001  00:01:02.030405  01:00:02.030405  01:02:00.000000