dimanche 28 juin 2015

best t-sql for providing nth page in showing data?

I want to item 1 to 50 in my first page by SELECT TOP(50) * From Items_table and it works fine but how can I get second 50 items for next page? How should be the query be?

Please note that I can't use sql LIMIT because I am using SQL SERVER. I have also problem with queries like:

    select * from (select ROW_NUMBER() over (ORDER BY date_of_creation desc, time_of_creation desc) AS Row2,* from Items_table ) ir
where ir.Row2 between @start and @end

the problem is in this condition table adapter doesn't support OVER. Is there any other t-sql code that table adapter support?

Aucun commentaire:

Enregistrer un commentaire