sql分页存储过程配合jquery 分页控件
ALTER PROCEDURE [dbo].[getData]
-- Add the parameters for the stored procedure here
@tb varchar(150),
@status nchar(2),
@indexpage int,
@endpage int
AS
declare @str varchar(200)
if @status is null
BEGIN
set @str=‘SELECT * FROM (SELECT ROW_NUMBER() OVER (order by T.ID desc)AS Row, T.* from ‘+@tb+‘ T where Status=‘‘‘+@status+‘‘‘ ) TT WHERE TT.Row between ‘+str(@indexpage)+‘ and ‘+str(@endpage)
exec(@str)
END
else
BEGIN
set @str=‘SELECT * FROM (SELECT ROW_NUMBER() OVER (order by T.ID desc)AS Row, T.* from ‘+@tb+‘ T ) TT WHERE TT.Row between ‘+str(@indexpage)+‘ and ‘+str(@endpage)
exec(@str)
END
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。