Conversions That Include Fractional Seconds - Teradata Vantage - Analytics Database

SQL Data Types and Literals

Deployment
VantageCloud
VantageCore
Edition
VMware
Enterprise
IntelliFlex
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2025-11-06
dita:mapPath
uds1628112204571.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
exs1472253032394
lifecycle
latest
Product Category
Teradata Vantageā„¢

The following rules apply to conversions that include fractional seconds:

  • The fractional seconds precision in the source character string must be less than or equal to the fractional seconds precision specified by the target type.
    SELECT CAST('12:30:25.44' AS TIME(3));

    If no fractional seconds appear in the source character string, then the fractional seconds precision is always less than or equal to the target data type fractional seconds precision, because the valid range for the precision is zero to six, where the default is six.

    SELECT CAST('12:30:25' AS TIME(3));
  • If the target data type is defined by a FORMAT phrase, the fractional seconds precision formatting characters must be greater than or equal to the precision specified by the data type.
    SELECT CAST('12h:15.12s:30m' 
    AS TIME(4) FORMAT 'HHh:SSDS(4)s:MIm');

    A FORMAT phrase must specify a fractional seconds precision of six if the target data type does not specify a fractional seconds precision, because the default precision is six.

    SELECT CAST ('12:30:25' AS TIME FORMAT 'HH:MI:SSDS(6)');