SQL分页语句 一.比较万能的分页: sql代码: 1 2 3 select top 每页显示的记录数 * from topic where id not in (select top (当前的页数-1)×每页显示的记录数 id from topic order by id desc) order by id desc 需要注意的是在access中不能是top 0,所以如果数据只有一页的话就得做判断了.. 二.SQL2005中的分页代码: sql代码: 1 2 3 4 5 6 --讲查询…
Asp.Net分页存储过程 SQL分页语句 一.比较万能的分页: sql代码: 1 2 3 select top 每页显示的记录数 * from topic where id not in (select top (当前的页数-1)×每页显示的记录数 id from topic order by id desc) order by id desc 需要注意的是在access中不能是top 0,所以如果数据只有一页的话就得做判断了.. 二.SQL2005中的分页代码: sql代码: 1 2 3…
using System; using System.Collections; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Collections.Generic; namespace Register.DataAccess { /// <summary> /// 数据访问抽象基础类 /// Copyright (C) Maticsoft /// </su…
高效分页存储过程 USE [db] GO /****** 对象: StoredProcedure [dbo].[p_Page2005] 脚本日期: // :: ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO ----------------------------------------------------- create PROCEDURE [p_Page] @tblName varchar(), -- TableName…
1.alert USE [数据库名称] GO /****** Object: StoredProcedure [dbo].[dbTab_PagerHelper] Script Date: 08/22/2010 13:30:39 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: Jarry -- Create dat…
简单的分页存储过程 CREATE PROC Paged @pageIndex INT, @pageCount INT OUTPUT, @pageSize INT AS DECLARE @count INT SELECT @count= COUNT(*) FROM dbo.Student SET @pageCount=CEILING(@count*1.0/@pageSize) SELECT * FROM (SELECT ROW_NUMBER() OVER(ORDER BY dbo.Student.…
/****** 对象: StoredProcedure [dbo].[P_CommonPagination] 脚本日期: 07/22/2009 10:22:01 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: -- Create date: 2008-12-16 -- Description: 支持DISTINC…
二.以下示例将返回行号为 50 到 60(含)的行,并以 OrderDate 排序. USE AdventureWorks; GO WITH OrderedOrders AS (SELECT SalesOrderID, OrderDate, ROW_NUMBER() OVER (order by OrderDate)as RowNumber FROM Sales.SalesOrderHeader ) SELECT * FROM OrderedOrders WHERE RowNumber betw…
存储过程 USE [ForeignTradeDB] GO /****** Object: StoredProcedure [dbo].[CommonGetDataPager] Script Date: 2015/3/26 17:47:02 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: <Author,,Name…