با استفاده از SQL Server Pivot-Unpivot
مجموعه ای از مقالات استفاده از SQL Server PIVOT
![Using Pivot & Unpivot](https://www.claytabase.co.uk/Academy/Learning-Databases/Using-SQL-Server-Pivot-Unpivot/Using-SQL-Server-PivotUnpivot.png)
PIVOT and UNPIVOT in SQL Server can be used in some amazing ways. Using some real world examples, we are going to show you what can be done.
Each stage gets a bit more complex, so step through each if you can.
1: Using UNPIVOT
Turn columns into rows, for instance useful when you need to break up a large table with months as columns.
2: Using PIVOT
Turn rows into columns, great for displaying data on an SSRS report.
3: Using PIVOT with dynamic SQL
Use dynamic SQL to extend this function to any unknown column names.
4: Using PIVOT and UNPIVOT together
Combine the two to re-build a table without a mass of CASE statements, or transfer data in a neutral form.