标签:
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
标签:
原文地址:http://www.cnblogs.com/anyben/p/4391822.html