Create Paging Query In the Sql Server

Here we create the Paging in SQL Server  Query here Fetch Only that Record which is Required

Query:

Select  S.*,SM.Name as shape,CM.Name as Color,PM.Name as Purity,POM.Name As Polish,CUM.Name as Cut,SYM.Name As Symm,Fm.Name as FLS from stock as S Inner join SHAPE_MAS As SM  on SM.SEQ_NO=S.shape_seq inner join COLOR_MAS As CM on CM.SEQ_NO=S.color_seq inner join PURITY_MAS As PM on PM.SEQ_NO=S.PURITY_SEQ inner join POLISH_MAS AS POM on POM.SEQ_NO=S.polish_seq inner join CUT_MAS As CUM on CUM.SEQ_NO=S.cut_seq inner join FLS_MAS As FM on FM.SEQ_NO=S.FLS_Seq inner join SYMM_MAS as SYM on SYM.SEQ_NO=S.SYMM_SEQ   order by S.SEQ_NO Asc OFFSET 25 * (2 - 1) ROWS  FETCH NEXT 25 ROWS ONLY


Note:  Here  25 is Page Size You have set Default you Want and 2 is page no it is change every page which record 

Example:
OFFSET 50 * (3 - 1) ROWS  FETCH NEXT 50 ROWS ONLY

Here we set Page Size 50 and page no is 3

This Is useful when we use  the html table use as Grid view and we have easily set the paging in Html Table.

Comments

Popular posts from this blog

Private Chat Using Node js and socket.io with encrypt and decrypt message and insert into mongo db

How To Migrate MVC 3 Application To MVC 5

Populate a drop-down in Vue.js and Asp.net Core from an ajax call