sql-serverpaginationjqgridlimit

How to do back end paging for jqgrid with mssql


I am trying to get my paging to work for jqgrid using MSSQL as source. I know you can use the limit command in MSSQL but unfortunately that does not exist in MSSQL, so how I can properly page using MSSQL?

Also, I need it to be able to work with search so i cant guarantee a constant number such as row number because the row numbers could vary during search.


Solution

  • Ok I got it working, but thank you anyway everyone. For everyone wondering though this is how i did it:

    SELECT * FROM(
    SELECT TOP $limit *
    FROM ( 
      SELECT TOP $nlimit *
      FROM   dbo.computers 
      ORDER BY **FIELD** ASC
    ) a 
    ORDER BY **FIELD** DESC
    ) a
    ORDER BY **FIELD** ASC;