SQL SERVER – Server Side Paging in SQL Server CE (Compact Edition)

SQL Server Denali is coming up with new T-SQL of Paging. I have written about the same earlier.

SQL SERVER – Server Side Paging in SQL Server Denali – A Better Alternative
SQL SERVER – Server Side Paging in SQL Server Denali Performance Comparison
SQL SERVER – Server Side Paging in SQL Server Denali – Part2

What is very interesting is that SQL Server CE 4.0 have the same feature introduced. Here is the quick example of the same. To run the script in the example, you will have to do install Webmatrix 4.0 and download sample database. Once done you can run following script.

SELECT *
FROM [Order Details] ORDER BY [Order ID] OFFSET 20 ROWS
FETCH NEXT 7 ROWS ONLY

SQL SERVER - Server Side Paging in SQL Server CE (Compact Edition) pagingce

Above script returns records 21 to 27 from the tables [Order Details]. OFFSET clause will skip the first 20 rows and then returns 7 rows. Please note, this T-SQL will throw error if ORDER BY is not used in the query.

I have found exactly similar post written by Jacob Sebastian on BeyondRelational.

Reference: Pinal Dave (https://blog.sqlauthority.com)

SQL Paging, SQL Scripts
Previous Post
SQL SERVER – Detecting Database Case Sensitive Property using fn_helpcollations()
Next Post
SQLAuthority News – SQL Server Quiz 2011 – All was well few moments before all went wrong – Reasons and Resolutions

Related Posts

5 Comments. Leave new

  • This is very nice feature.

    But why do I need to install webmatrix4.0? what is the relation between T-SQL and webmatrix4.0?

    I have checked this feature in sql server 2008 EE. It is not working. I dont have webmatrix4.0 on my machine.

    Thank you

    Reply
  • Is there any way to run the same in Sql Server 2008 Enterprice Edition

    Reply
  • How Can i use Offset and limit in microsoft sql server 2008 ???

    Reply

Leave a Reply