Argument | Category | Description |
---|---|---|
PartitionColumns | Required | Specifies the same columns as the PARTITION BY clause (in any order). |
NumberOfRows | Optional | Specifies the maximum number of rows in any partition. If a partition has fewer than number_of_rows rows, then the function adds NULL values; if a partition has more than number_of_rows rows, then the function omits the extra rows. If you omit this argument, then you must specify the PivotColumn argument. With this argument, the ORDER BY clause is optional. If omitted, the order of values can vary. The function adds NULL values at the end.
|
PivotColumn | Optional | Specifies the name of the column that contains the pivot keys. If the pivot column contains numeric values, then the function casts them to VARCHAR. If you omit the NumberOfRows argument, then you must specify this argument. If you specify the PivotColumn argument, then you must order the input data; otherwise, the output table column content is nondeterministic. For details, see Ordering Input Data.
|
PivotKeys | Optional | If you specify the PivotColumn argument, then this argument specifies the names of the pivot keys. Do not use this argument without the PivotColumn argument. If pivot_column contains a value that is not specified as a pivot_key, then the function ignores the row containing that value (see Example 2: Specify Pivot Keys). By default, every unique value in pivot_column is a pivot key (see Example 1: Use Default Pivot Keys). |
TargetColumns | Required | Specifies the names of the input columns that contain the values to pivot. |