I have been demonstrating how to create high performance Pivot transformations of data using SQL or Linq. Those queries both use a Pivot Table to enhance the performance of the transformation. Today I am posting the inverse, How to Achieve High Performance Un-Pivot Transformations Using a Pivot Table. You don't have to rely on your reporting engine to perform your Pivot/Un-Pivot work. You can do it in your database engine, or using Linq for non-SQL data sources. The Linq version works with sets that are IEnumerable<>. This technique is the fastest un-pivot method I have found in the last 20 years, hands down. Cheers, Ben
Heh... so much for the "fastest method in 20 years"... Here's what I get when I click on the link or copy the underlying URL...
is pronounced "ree-bar
" and is a "Modenism
" for R
ow.First step towards the paradigm shift of writing Set Based code:________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.
Dear Lord... I'm a production DBA. Please grant me patience because, if you grant me strength, I'm gonna need bail money to go with it.
Helpful Links:How to post code problemsHow to Post Performance ProblemsCreate a Tally Function (fnTally)