Posts

Showing posts from January, 2014

Paging in Database

Paging in records from database. Some time you need to get number or recording at a time from large number of records. Just as .NET has gridview control with paging utility. So some time we need to create own logic for paging in records at database leve. So below is the code to accomplish that task. /* * Below code is simple to understand.. * */ DECLARE @employees AS TABLE ( EmpId INT IDENTITY ( 1 , 1 ), EmpName VARCHAR ( 20 ), Salary INT ) INSERT INTO @employees ( EmpName , Salary ) VALUES ( 'Sohan' , 2000 ), ( 'Rohan' , 4000 ), ( 'Mohan' , 3000 ), ( 'Ram' , 2000 ), ( 'Seema' , 3000 ),( 'Micky' , 2500 ), ( 'Rinky' , 4000 ), ( 'Ronin' , 5000 ), ( 'Robin' , 2000 ), ( 'Sam' , 4000 ), ( 'Sohil' , 3000 ), ( 'Raven' , 2000 ), ( 'Gery' , 5000 ), ( 'Bob' , 2000 ), ( 'Denis' , 4000 ), ( 'Steph' , 3000 ), ( &