分布存储过程
alter proc dbo.Get_NewsByClass
(@startIndex int,
@endIndex int,
@Classid int,
)
as
set nocount on
begin
declare @indextable table(id identity(1,1),nid int)
set rowcount @endIndex
intsert into @indextable(nid) select ID from News where Classid=@Classid order by ID desc
select * from News o,@indextable t where o.ID=t.nid and t.id between @startIndex and @endIndex order by t.id
end
set nocount off
(@startIndex int,
@endIndex int,
@Classid int,
)
as
set nocount on
begin
declare @indextable table(id identity(1,1),nid int)
set rowcount @endIndex
intsert into @indextable(nid) select ID from News where Classid=@Classid order by ID desc
select * from News o,@indextable t where o.ID=t.nid and t.id between @startIndex and @endIndex order by t.id
end
set nocount off