Paging Data in SQL Server 2000

Up until now I’ve been blowing off adding paging support to my web projects. This is very bad practice and I figured it was time to stop. Now I know enough SQL to make a SELECT command (if I have a program that can generate it for me :P) so I didn’t even know where to BEGIN with this one.

Thankfully, the knowlegable folks over at 4GuysFromRolla.com have already done the work for me and gave detailed steps in this handy tutorial that made creating the paging stored procedure a SNAP!

Thanks to their detailed tutorial I was able to modify their stored procedure to make a custom pager for my own projects, and it works GREAT!

Now that I have this procedure I’m going to have to work on the actual page logic to create the paging links and the code to pass the current page into the procedure. I know that the new SQL Server 2005 has newer features that make this simpler to implement, but my host still runs SQL Server 2000, and it’s good to know how to do it in the old school way anyway in case it comes up again, and God knows it will!

-SelArom