UNPIVOT
Create a new table by unpivoting columns from a source table.
Allows creating a new table by unpivoting columns from a source table. Table is the name for the new table. Discrete column is the column from the source table that is the primary key. It must be discrete. Columns to unpivot is a list of numeric columns (integer or longinteger) to use for unpivoting. Filter is an optional filter.
For example, you could generate a table with all the dates included in a date interval. In a source table with a primary key (PK) and with columns startdate and enddate, the user can generate a target table with all PK and all the dates in the interval between startdate and enddate.
An Unpivot instruction must have the following syntax:
Syntax
UNPIVOT [Target table] [Target discrete column] [Columns to unpivot] [Filter]
Parameters
Target table
Defines a database, and table.
Target column
Defines the name of the target, discrete column.
Columns to unpivot
A List of numeric columns (integer or long integer) to use for unpivoting.
Filter
Optional. Defines a domain in case you want to filter the data.