Code
1set ANSI_NULLS ON
2set QUOTED_IDENTIFIER ON
3go
4--根据类别编号获取类别
5
6
7
8create procedure P_GetListByTypeID
9(@startIndex int,
10@endIndex int,
11@Product_Type int
12)
13as
14set nocount on
15declare @indextable table(id int identity(1,1),nid int)
16set rowcount @endIndex
17insert into @indextable(nid) select Product_ID from Product where Product_Type=@Product_Type order by Product_ID desc
18
19select * FROM Product A
20inner join @indextable t on A.Product_ID=t.nid
21where Product_Type=@Product_Type and t.id between @startIndex and @endIndex order by t.id
22
23set nocount off
24 RETURN
25
26
27
28
29
30
31
32
33
记录一条自己常用的分页存储过程
Code