So, I have a function that returns several records that I want to implement swap on my site. I was suggested that I use Offset / Fetch Next in SQL Server 2012 to accomplish this. On our website, we have an area that shows the total number of entries and which page you are at that time.
I used to get the whole set of records and was able to program paging. But using the SQL method with FETCH NEXT X ROWS ONLY, they give me only X rows, so I donβt know what my total recordset is and how to calculate my minimum and maximum pages. The only way I can say this is to call the function twice and count the lines on the first and then run the second with FETCH NEXT. Is there a better way that won't force me to execute the request twice? I'm trying to speed things up, not slow it down.
performance sql-server-2012 paging
CrystalBlue Sep 10 '12 at 13:11 2012-09-10 13:11
source share