简单问题,菜鸟不懂,高手指点,弄不懂不睡觉!!!!
CREATE procedure dbo.jady_Pagination
@TableName varchar(20),
@IndexCol char(20),
@CurrentPage int,
@PageCount int,
@EndBool bit output
as
declare @LastRecord int
set @LastRecord=(select top 100 IndexCol from QQ_Person_Online where IndexCol=@CurrentPage*@PageCount order by IndexCol)
exec('select * from ' + @TableName + ' where '+@IndexCol+' between ((' + @CurrentPage + '-1)*' + @PageCount + '+1) and ' + @CurrentPage + '*' + @PageCount + ' order by '+@IndexCol)
if(@LastRecord=2)
begin
set @EndBool=1
end
else
begin
set @EndBool=0
end
GO
问题在set @LastRecord…………一句
其中的IndexCol(列名),QQ_Person_Onilne(表名)该如何参数化?为什么@CurrentPage和@PageCount可以直接用变量代入而@IndexCol和@TableName却不可以?
请祥解,谢谢!