pivot

Script to create dynamic PIVOT queries in SQL Server

  • Article

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.

2012-11-09

5,308 reads

Blogs

Join me at SQLBits 2020

By

The SQLBits conference is taking place in London again this year, between March 31st...

DBA, a job, a vital job

By

DBA, a job, a vital job. T-SQL a language that is fun. Select, a...

SOS_SCHEDULER_YIELD – What is it really telling us?

By

I decided to write this off the back of a conversation I was having...

Read the latest Blogs

Forums

Question up greading

By itmasterw 60042

Hi, I see the post of going from 2012 - 2019 but we were...

Constraint on multiple columns

By SIJCOOKE

Hi, I want to restrict users from adding duplicate rows. Is there a way...

Table self-join for derived columns

By pwalter83

Hi, I have a requirement to derive additional columns and populate the values by...

Visit the forum

Ask SSC

SQL Server Q&A from the SQLServerCentral community

Get answers