select * from Goods

--创建存储过程
create proc sp_Show
(
@index int, --当前页
@size int, --每页大小
@totalcount int out, --总数据数
@pagecount int out --总页数
)
as
begin
--计算总数据数
select @totalcount=COUNT(*) from Goods --(where name like '%'+ @name +'%')
--计算总页数
set @pagecount=CEILING(@totalcount*1.0/@size)

if(@index<=0)
set @index=1
if(@index>=@pagecount)
set @index=@pagecount

--分页查询
select * from
(select ROW_NUMBER() over(order by GId) rn,*from Goods) tb1 where ----(where name like '%'+ @name +'%')
rn between ((@index-1)*@size)+1 and (@index*@size)
end

declare @x int,@y int
exec sp_Show 1,2,@x out,@y out
select @x 总数据数,@y 总页数

最新文章

  1. UVA数学入门训练Round1[6]
  2. 2424: [HAOI2010]订货
  3. js简单上传进度条
  4. QT5.4关联VS2010,配置VAssistX关联Qt类
  5. .NET 4.0 兼容 .NET 2.0 的方法
  6. 再关于IE11
  7. Python中安装numpy,scipy,matplotlib安装方法
  8. hdu4746 Mophues
  9. POJ 1755 Triathlon [半平面交 线性规划]
  10. JavaScript 克隆
  11. Database Change Notification
  12. jquery 获取name一样的值
  13. Android 手机版 ssr
  14. CNN(卷积神经网络)、RNN(循环神经网络)、DNN,LSTM
  15. Python logging模块简介
  16. Nginx服务器的图片防盗链
  17. Dubbo服务容错
  18. CSS实现鼠标悬浮无限向下级展示的简单代码
  19. Jquery 的ajax里边不能识别$(this)
  20. Unity 网格 绘制

热门文章

  1. Visual Studio 安装时,共享组件、工具和SDK的路径无法更改解决方法
  2. 01_Node的版本管理
  3. vue2中底层响应式数据实现
  4. win10彻底关闭系统更新 - 禁用 Windows Update Medic Service服务(1803和1809版本)
  5. selenium+python的网站爬虫
  6. tidb 杂记
  7. Qt-设置背景色
  8. 字符串类型如何格式化保留小数点后两位【ToString(&quot;0.00&quot;)】
  9. 对qa 工作的理解
  10. 使用Kali破解无线密码