Server side pagination in Azure ( MS SQL ) -


how implement pagination in sql query in azure specific , how specify limit , offset ....

i supposed show 50 records per page , there 4000 records in database

i writing api same fetch records using sql query .... how specify in ms sql query

select  *   yourtable  order someuniquecolumn offset 0 rows fetch next 50 rows ; 

you can use variables below:

declare    @pagenum  int = 1,   @pagesize int = 10;  select * yourtable order someuniquecolumns offset (@pagenum - 1) * @pagesize rows fetch next @pagesize rows only; 

references:
http://sqlmag.com/blog/sql-server-2012-t-sql-glance-offsetfetch


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -