USE [APS_Future_FT] GO /****** Object: StoredProcedure [dbo].[A_PagingAndSorting] Script Date: 2013/11/7 21:42:16 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: <Author,,Name> --…
直接上代码 --top not in方式 select top 条数 * from tablename where Id not in (select top 条数*页数 Id from tablename) --ROW_NUMBER() OVER()方式 select * from ( select *, ROW_NUMBER() OVER(Order by Id ) AS RowNumber from tablename ) as b *条数 and 页数*条数 --offset fetch…
USE tempdb GO SET NOCOUNT ON --创建表结构 IF OBJECT_ID(N'ClassB', N'U') IS NOT NULL DROP TABLE ClassB GO ), CreateDate DATETIME, AID INT, Status INT) CREATE INDEX IDX_CreateDate ON ClassB(CreateDate) CREATE INDEX IDX_AID ON ClassB(AID) GO --插入测试数据 DECLARE…
SELECT ContractName ,ContractNO, State,CreateDate FROM (SELECT ContractName ,ContractNO,CreateDate, State,ROW_NUMBER() OVER (ORDER BY CreateDate DESC) AS RowNumber FROM dbo.MALL_Contract) T1WHERE RowNumber BETWEEN 10 AND 20…
在工作中,有时,我们会用到oracle分页查询.这时,就需要先了解oracle的rownum.rowmun是oracle的伪列,只能用符号(<.<=.!=),而不能用这些符号(>,>=,=,between...and)比如我们要查询prpdriskconfig表,这条sql:select * from prpdriskconfig where configcode='UndwrtCollectFlow'总共有58条数据,我们现在只想要前50条数据,这是就需要用到rownum了. )…