急急急`一个存储过程做分页是的问题``帮忙看看```
下边的存储过程``出错了```不知怎样解决   
 CREATE   PROCEDURE   testNew    
 (   
 @tint_tableid   tinyint=1,                  --这个是BBS的当前版面Id,你可以不用管他。。 
 @int_pagenow   int=0,                                        
 @int_pagesize   int=0, 
 @int_recordcount   int=0   output,         --就是得出BBS某个版面的总贴数。。 
 @xl   varchar(200), 
 @order   varchar(200) 
 )   
 AS 
 set   nocount   on   
 declare   @int_allid   int                   
 declare   @int_beginid   int,@int_endid   int          
 declare   @int_pagebegin   int,   @int_pageend   int 
 declare   @sql1   varchar(400),@sql2   varchar(400)   
 --select   @int_allid=count(*)   from   tab_discuss   where   tint_level=0   and   tint_tableid=@tint_tableid 
 set   @sql1= 'select   @int_allid=count(*)   from   Product   where       '   +@xl 
    exec   (@sql1) 
             select   @int_recordcount=@int_allid                           --得出该版面的总贴数   
 	set   @sql2= 'declare   cro_fastread   cursor      scroll    
 	for      select   Pr_id   from   Product   where    '+@xl+ '   order   by    '+@order 
          --   for         select   Pr_id   from   Product   where   tint_level=0   and   tint_tableid=@tint_tableid   order   by   int_id   desc      --这里定义游标操作,但是不用临时纪录集,而且游标也不需要全部遍历所有纪录集。 
 exec   (@sql2) 
             open   cro_fastread      --打开游标 
             select   @int_beginid=(@int_pagenow-1)*@int_pagesize+1      --得出该页的第一个纪录Id 
             select   @int_endid   =   @int_beginid+@int_pagesize-1                  --得出该页的最后一个纪录的Id               
             fetch   absolute      @int_beginid   from   cro_fastread   into   @int_pagebegin   --将他的Id传给一个变量该页开始的Id 
             if   @int_endid> @int_allid                        --这里要注意,如果某一页不足固定页数的纪录时。如只有一页纪录,而且纪录少于我们定义的数目。或者是最后一页时。。。 
                         fetch   last   from   cro_fastread   into   @int_pageend         --直接将游标绝对定位到最后一条纪录,得出他的id号来。。。 
             else 
                         fetch   absolute   @int_endid   from   cro_fastread   into   @int_pageend                                                   
             select   pr_id,Pr_spec,pr_name,pr_picture,pr_price,pr_url,pr_brand,pr_sort2,pr_stoppro   from   Product   where      Pr_id   between   @int_pageend   and   @int_pagebegin   --order   by   int_rootid   desc,num_order   desc             
    --我们就可以利用该页的第一个id和最后一个id得出中间的id来。。。。(注意。我们这个BBS的数性结构用了一种很巧妙的算法,就是用一个orderNum浮点数即可完成排序。。。)   
 --开始清场。。。 
             close   cro_f