Script to create dynamic PIVOT queries in SQL Server
Posted
on SQL Server Central
See other posts from SQL Server Central
Published on Fri, 09 Nov 2012 07:00:00 UT
Indexed on
2012/11/10
17:12 UTC
Read the original article
Hit count: 179
Pivoting is a common reporting requirement - data is stored in columns and you need to present it in rows. This was a nice feature that was added to SQL Server, but you don't always know all of the values you need to pivot on. This tip looks at how you can dynamically create the pivot command to handle these unknown values.
Top 5 hard-earned lessons of a DBA In part one, read about ‘The Case of the Missing Index’ and learn from the experience of The DBA Team. Read now. |
© SQL Server Central or respective owner