存储过程分页的经典例子
2009-03-14 14:13 苏飞 阅读(1306) 评论(0) 编辑 收藏 举报原文:http://www.sufeinet.com/thread-2111-1-1.html
USE [PLAYBAR_PERSONAL] GO /****** 对象: StoredProcedure [dbo].[CP_select_All_Customer] 脚本日期: 03/10/2009 21:09:12 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: sufei -- Create date: <2009-2-16,,> -- Description: <查询所有的用户信息 ---Table (手机号,用户名,用户信箱,用户年龄,性别,用户职业,兴趣爱好,现居地,用户积分,注册时间 ,备注) -- ============================================= ALTER PROCEDURE [dbo].[CP_select_All_Customer] @startindex int , @pagesize int AS BEGIN with NewCustomer as ( select row_number()over (order by Cus_Id)as rownumber, Cus_MSISDN,Cus_Name,Cus_Email,Cus_Age,Cus_Sex,Cus_Job,Cus_Intrestings,Cus_Address,Cus_Value,Cus_RegTime,Cus_Remark,Cus_State from Customer where Isdelete=0 ) select rownumber, Cus_MSISDN,Cus_Name,Cus_Email,Cus_Age,Cus_Sex,Cus_Job,Cus_Intrestings,Cus_Address,Cus_Value,Cus_RegTime,Cus_Remark,Cus_State from NewCustomer where rownumber >=(@startindex-1)*@pagesize+1 and rownumber<=(@startindex-1)*@pagesize+(@pagesize) select count(*) from Customer where Isdelete=0 END
本人的博客不再维护从2013年就不再维护了
需要我帮助的朋友请到我的个人论坛 http://www.sufeinet.com 进行讨论,感谢大家对我的支持!