TD_UNPIVOT | SQL Operators & User-Defined Functions | Teradata Vantage - 17.10 - TD_UNPIVOT - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Operators and User-Defined Functions

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Administration
Programming Reference
Publication ID
B035-1210-171K
Language
English (United States)

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)