PTR logo

Blog Post

SQL Server - Dynamic SQL To Create a Pivot Table

SQL Server - Dynamic SQL To Create a Pivot Table
Motion graphic.

SQL Server PIVOT Function With Dynamic Column Groups

A while back one of my delegates asked me if there was a way to create a Pivot Table using the SQL Server SQL PIVOT function, but generating the Pivot Columns dynamically rather than listing a static set of columns.

The answer? Yes.

If yiu are not already familiar with using the PIVIT function I suggest you take a look at the ########### blog

Before launching in to working with dynamic SQL and Transact SQl scripting let’s take a look at the PIVOT function itself and see how it works.

Share This Page

MD

Mandy Doward

Managing Director

PTR’s owner and Managing Director is a Microsoft MCSE certified Business Intelligence (BI) Consultant, with over 30 years of experience working with data analytics and BI.

Latest Articles

Frequently Asked Questions

Couldn’t find the answer you were looking for? Feel free to reach out to us! Our team of experts is here to help.

Contact Us