Posted by Plamen Ratchev on 01/23/07 18:24
I have not done deep analysis on performance but I would guess there will
not be much difference. It seems the PIVOT operator in SQL Server 2005
applies similar logic to the one used with the CASE technique. Using the
CASE technique is very efficient because it scans the base table only once.
You can always compare execution plans for the particular case and see which
one performs better.
The PIVOT operator is a bit confusing at first look and takes time to get
used to the syntax. One benefit is that it allows writing shorter code.
Regards,
Plamen Ratchev
http://www.SQLStudio.com
Navigation:
[Reply to this message]
|