You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/t-sql/queries/from-using-pivot-and-unpivot.md
+17-6Lines changed: 17 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ description: Learn about the Transact-SQL PIVOT and UNPIVOT relational operators
4
4
author: VanMSFT
5
5
ms.author: vanto
6
6
ms.reviewer: wiassaf, randolphwest
7
-
ms.date: 10/01/2024
7
+
ms.date: 02/24/2026
8
8
ms.service: sql
9
9
ms.subservice: t-sql
10
10
ms.topic: reference
@@ -92,15 +92,26 @@ FOR <output column for names of the pivot columns>
92
92
93
93
## Remarks
94
94
95
-
The column identifiers in the `UNPIVOT` clause follow the catalog collation.
95
+
-The column identifiers in the `UNPIVOT` clause follow the catalog collation.
96
96
97
-
- For [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], the collation is always `SQL_Latin1_General_CP1_CI_AS`.
97
+
- For [!INCLUDE [ssazure-sqldb](../../includes/ssazure-sqldb.md)], the collation is always `SQL_Latin1_General_CP1_CI_AS`.
98
98
99
-
- For [!INCLUDE [ssNoVersion_md](../../includes/ssnoversion-md.md)] partially contained databases, the collation is always `Latin1_General_100_CI_AS_KS_WS_SC`.
99
+
- For [!INCLUDE [ssNoVersion_md](../../includes/ssnoversion-md.md)] partially contained databases, the collation is always `Latin1_General_100_CI_AS_KS_WS_SC`.
100
100
101
-
If the column is combined with other columns, then a collate clause (`COLLATE DATABASE_DEFAULT`) is required to avoid conflicts.
101
+
-If the column is combined with other columns, then a collate clause (`COLLATE DATABASE_DEFAULT`) is required to avoid conflicts.
102
102
103
-
In [!INCLUDE [fabric](../../includes/fabric.md)] and [!INCLUDE [ssazuresynapse_md](../../includes/ssazuresynapse-md.md)] pools, queries with `PIVOT` operator fail if there's a `GROUP BY` on the nonpivot column output by `PIVOT`. As a workaround, remove the nonpivot column from the `GROUP BY`. Query results are the same, as this `GROUP BY` clause is a duplicate.
103
+
- In [!INCLUDE [fabric](../../includes/fabric.md)] and [!INCLUDE [ssazuresynapse_md](../../includes/ssazuresynapse-md.md)] pools, queries with `PIVOT` operator fail if there's a `GROUP BY` on the nonpivot column output by `PIVOT`. As a workaround, remove the nonpivot column from the `GROUP BY`. Query results are the same, as this `GROUP BY` clause is a duplicate.
104
+
105
+
- Column names are of type **sysname** or **nvarchar(128)**. Because `UNPIVOT` projects column names as values, the data type for an `UNPIVOT` column will also be **nvarchar(128)**, which is not a supported data type in Fabric Data Warehouse. If you want to save the results of `UNPIVOT` to a table in a warehouse in Fabric, cast it to a [supported data type in Fabric Data Warehouse](/fabric/data-warehouse/data-types). For example:
0 commit comments