User325940419 posted
Excellent Feature (OFFSET and FETCH) of MS SQL Server 2012
CREATE PROCEDURE FetchRow
(
@OffSetRowNo int,
@FetchRowNo int
)
AS
SELECT ItemID,ItemName,Description FROM MDItem
ORDER BY ItemID DESC
OFFSET @OffSetRowNo ROWS
FETCH NEXT @FetchRowNo ROWS ONLY
GO
output
-------------
ItemID ItemName Description
1505 Stone Chips good chips
1504 Shingles Notice
1503 Filling-earth Idea
1502 5000 PSI
1501 DF 10mm 72.5 Grade
1498 Mellamine Board
1494 we4twert test uopasd
1492 Facial Tissue fay
1491 Tissue bangla
1490 Mum Water water
with this procedure you can define how many rows you want to ignore and fetch.
@OffSetRowNo this parameter define how many rows you want to ignore
and
@FetchRowNo this parameter define how many rows you want to fetch.