views:

64

answers:

1

table 'sample' contaning fields [AffiliateId] as a primary key, [AffiliateCode] L, [Name] , [AddressId] [, [Url] , [EmailId] , [ShopId] ,

i need a stored procedure for custom paging

+4  A: 

in sqlserver 2005 reference or example:

SELECT * FROM ( SELECT row_number() OVER (ORDER BY id) AS resultNum, id FROM table_name) AS numberResultsWHERE resultNum  BETWEEN ? AND ?

for older versions see reference or reference2

sfossen
thank you but last written like that resultNum BETWEEN ? AND ?,,what this means
peter
the ? is used SQL prepared statements as a placeholder for a variable, in this case the 2 numbers for limiting the ranges.
sfossen