TIMESTAMP_DIFFERENCE_UDF

Definition

UDF That reproduces DATETIME Subtraction

PUBLIC.TIMESTAMP_DIFFERENCE_UDF
(MINUEND TIMESTAMP, SUBTRAHEND TIMESTAMP, INPUT_PART VARCHAR)

Differences between Teradata and Snowflake date time subtraction

Teradata and Snowflake handle date time subtraction different, the syntax, returned type and precision are different.

Some operations may produce different day outputs with an error range of 1 unit.

Parameters

MINUEND TIMSTAMP

Date subtracted from.

SUBTRAHEND TIMESTAMP

Date subtracted.

INPUT_PART VARCHAR

Parts to be returned.

Returns

Formatted string value according to the INPUT_PART parameter.

Example

Input

IN -> Teradata_01.sql
select (timestampColumn1 - timestampColumn2 YEAR) from tableName;

Output:

OUT -> Teradata_01.sql
SELECT 
(
PUBLIC.TIMESTAMP_DIFFERENCE_UDF(timestampColumn1, timestampColumn2, 'YEAR')) from
tableName;

Last updated