下边是我写的,现在我想加一个返回总数用于分页的总数绑定
declare @pagesize int,@pageNum int
set @pagesize=10
set @pageNum=1
select * from (
select *,row_number() over(order by 表) rn
from 表) a
where rn between @pagesize*(@pageNum-1) and @pagesize*(@pageNum)-1
加一个output参数
@count int output
set @sql='select @a=count(*) from table'
exec sp_executesql @sql N,'@a int out',@count output