码迷,mamicode.com
首页 > 数据库 > 详细

sql分页存储过程配合jquery 分页控件

时间:2015-04-04 12:02:41      阅读:142      评论:0      收藏:0      [点我收藏+]

标签:

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

sql分页存储过程配合jquery 分页控件

标签:

原文地址:http://www.cnblogs.com/anyben/p/4391822.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!