TD_UNPIVOT | SQL Operators & User-Defined Functions | Teradata Vantage - TD_UNPIVOT - Analytics Database - Teradata Vantage

SQL Operators and User-Defined Functions

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
Language
English (United States)
Last Update
2024-04-05
dita:mapPath
xub1628111590556.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
drp1544241916620
lifecycle
latest
Product Category
Teradata Vantage™

Transforms table columns into rows.

ANSI Compliance

This statement is a Teradata extension to the ANSI SQL:2011 standard.

Required Privileges

You must have EXECUTE FUNCTION privileges on the function or on the database containing the function.

Syntax

[TD_SYSFNLIB.] TD_UNPIVOT (
  ON { tableName | ( query_expression ) }
  USING VALUE_COLUMNS ( 'value_columns_value' [,...] )
  UNPIVOT_COLUMN ( 'unpivot_column_value' )
  COLUMN_LIST ( 'column_list_value' [,...] )
  [ COLUMN_ALIAS_LIST ( 'column_alias_list_value' [,...] )
      INCLUDE_NULLS ( { 'No' | 'Yes' } )
  ]
)

Syntax Elements

TD_SYSFNLIB.
Name of the database where the function is located.
tableName
The name of the table with the input data for the function.
query_expression
The SELECT statement with input data for the function.
VALUE _COLUMNS
Specifies the destination column or columns for the unpivoted data.
UNPIVOT_COLUMN
Specifies the name of the output column identifying the unpivoted data in each row of the value column of columns.
COLUMN_LIST
Specifies the input column data for the unpivoting operation.
COLUMN_ALIAS_LIST
Specifies alternate names for the values in the unpivoted column.
INCLUDE_NULLS
Specifies whether or not to include nulls in the transformation. Valid values:
  • ‘Yes'
  • ‘No’ (default)