Pages

4/19/2011

Paging through SQL Server

This query will help you in doing paging through SQL Server. You will need to pass just the starting and ending index and it will return the records.. DECLARE @startingindex int; DECLARE @endingindex int set @startingindex=10 set @endingindex=20 select * from Table_Name where table_id in( SELECT us.table_id FROM (SELECT ROW_NUMBER() OVER (ORDER BY table_id) AS Row, Table_id FROM Table_Name) us WHERE Row >@startingindex and Row<@endingindex ...


Pages 81234 »
Twitter Delicious Facebook Digg Favorites More