用于搜索的分页

时间:2009-03-24 15:15:20

标签: sql-server stored-procedures

表'样本'包含字段     [AffiliateId]作为主键,     [AffiliateCode] L,     [名称] ,     [AddressId] [,     [url],     [电子邮件ID] ,     [ShopId],

我需要一个自定义分页的存储过程

1 个答案:

答案 0 :(得分:4)

在sqlserver 2005 referenceexample中:

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

对于旧版本,请参阅referencereference2