Local Variables Also Cause Performance Problems In The ORDER BY Clause In SQL Server

Local Disasters

I see this kind of pattern a lot in paging queries where people are doing everything in their power to avoid writing dynamic SQL for some reason.

It’s almost as if an entire internet worth of SQL Server …

Yet Another Post About Local Variables In SQL Server

If I Ruled The World

Normally, I link people to this post by Kendra and this post by Paul when I need to point them to information about what goes wrong with local variables. They’re both quite good, but I …