用存储过程实现翻页
来源:互联网 发布:叶根友特楷简体 mac 编辑:程序博客网 时间:2024/05/04 04:41
USE [CARD_DB]
GO
/****** Object: StoredProcedure [dbo].[pr_get_star_user_list_v2] Script Date: 03/05/2010 15:27:18 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/*
查询STAR用户记录
最后更新:2009-11*/
ALTER PROCEDURE [dbo].[pr_get_star_user_list_v2]
@date bigint, -- 时间 分页用
@forward int, -- 为0(首页)/1是下翻页,2/3(末页)上翻页
@num int,
@type tinyint
AS
begin
if(@type =0)
begin
-- 首页
if @forward = 0
select top (@num) type,uid,level,nickname,room_name,bank_name,bank_branch_name,bank_user_name,bank_account,tel,create_date
from t_staruser with(nolock) order by create_date desc
-- 向下翻页
if @forward = 1
select top (@num) type,uid,level,nickname,room_name,bank_name,bank_branch_name,bank_user_name,bank_account,tel,create_date
from t_staruser with(nolock) where create_date < @date order by create_date desc
-- 向上翻页
if @forward = 2
select * from (
select top (@num) type,uid,level,nickname,room_name,bank_name,bank_branch_name,bank_user_name,bank_account,tel,create_date
from t_staruser with(nolock) where create_date > @date order by create_date
) x
order by create_date desc
-- 尾 页
if @forward = 3
select * from (
select top (@num) type,uid,level,nickname,room_name,bank_name,bank_branch_name,bank_user_name,bank_account,tel,create_date
from t_staruser with(nolock) order by create_date
) x
order by create_date desc
end
else
begin
-- 首页
if @forward = 0
select top (@num) type,uid,level,nickname,room_name,bank_name,bank_branch_name,bank_user_name,bank_account,tel,create_date
from t_staruser with(nolock) where type=@type order by create_date desc
-- 向下翻页
if @forward = 1
select top (@num)type,uid,level,nickname,room_name,bank_name,bank_branch_name,bank_user_name,bank_account,tel,create_date
from t_staruser with(nolock) where type=@type and create_date < @date order by create_date desc
-- 向上翻页
if @forward = 2
select * from (
select top (@num) type,uid,level,nickname,room_name,bank_name,bank_branch_name,bank_user_name,bank_account,tel,create_date
from t_staruser with(nolock) where type=@type and create_date > @date order by create_date
) x
order by create_date desc
-- 尾 页
if @forward = 3
select * from (
select top (@num) type,uid,level,nickname,room_name,bank_name,bank_branch_name,bank_user_name,bank_account,tel,create_date
from t_staruser with(nolock) where type=@type order by create_date
) x
order by create_date desc
end
end
- 用存储过程实现翻页
- 数据翻页--存储过程实现
- 翻页的存储过程
- 存储过程翻页
- 存储过程翻页2
- 存储过程翻页
- 存储过程翻页2
- 翻页的存储过程
- 翻页的存储过程
- sql2000 翻页存储过程
- 怎样写一个实现翻页的存储过程
- 翻页存储过程改进版
- 翻页功能的存储过程
- 完美翻页存储过程实例
- MySQl通用翻页(存储过程)
- MySQl存储过程翻页查询
- 经典的翻页存储过程[推荐]
- Asp.net中,用Oarcle存贮过程实现,高效率翻页
- 如何使DIV层居中
- 拿破仑·希尔的十七项成功原则
- 关于淘宝 TOP 开发 使用的一些心得,问题不断更新中。。。
- 看了刘未鹏的文章,我也来写啥,要不白看了
- Flex开源框架汇总
- 用存储过程实现翻页
- http://blog.163.com/qualifier@126/
- 可编辑子项的CListCtrl类
- WebService的一个C#实例(VS2008)
- windows消息分流器
- 我写博客一年多来的八点体会
- Windows 中不规则窗体的编程实现
- extjs 控件操作
- 4.12--如何在对话框中使用UPDATE_COMMAND_UI机制?