Efficient Paging in SQL Server 2005
Join the DZone community and get the full member experience.Join For Free
It is a little bit off topic for my blog, but I came across a situation today while at work where I needed to page the results of a stored proc, but at the same time I needed to make sure that the database wasn't looking through so many rows that it would cause a slowdown. The solution that I came up with is not exactly the most novel solution that exists, but it certainly did the job. And from the testing I did, it is pretty efficient. I also realized how many new features in SQL Server 2005 it used (so old school), and so, I figured I'd throw it up here hoping that it might help someone. Also, hopefully someone will point out something that could be done better.
Published at DZone with permission of Justin Etheredge. See the original article here.
Opinions expressed by DZone contributors are their own.