Transact-SQL PIVOT and UNPIVOT

This pair of T-SQL commands always seem odd to cover in tandem because they’re not opposites. However, I feel like it’s more confusing to describe them apart from each other. Plus, it’s not like they don’t have any similarities.

Well, as promised, here are the slides and scripts from my presentation: T-SQL PIVOT & UNPIVOT (ZIP).

If you have any questions about the content, drop me a line.

2 thoughts on “Transact-SQL PIVOT and UNPIVOT

  1. Thank you for making this available – I find the graphics especially helpful in understanding the makeup of each operator, and how they compare to each other.

    I’ve been tasked with presenting a short overview of these operators within my department (informatics at a health care company). Would it be okay if I used some of your slides? – with attribution, of course.

    1. Certainly. I must mention that I no longer give this presentation. Not because the PIVOT/UNPIVOT aren’t helpful. Rather the use of OUTER APPLY is more flexible. Also, the last time I checked it out, APPLY was more performant as well. Brad Schulz’s 2-part blog post was the first time I encountered it.

Thanks for stopping by. I do enjoy hearing from you...