分页选取新闻

USE [Publishing System ]
GO
/****** Object:  StoredProcedure [dbo].[Procselectanynews]    Script Date: 05/12/2010 12:18:29 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:  韩慧
-- Create date: 2010-5-10
-- Description: 分页选取新闻
-- =============================================
ALTER PROCEDURE [dbo].[Procselectanynews]
 -- Add the parameters for the stored procedure here
 @startIndex int,@endIndex int
AS
BEGIN
 with temptbl as (
  SELECT ROW_NUMBER() OVER (ORDER BY id desc)AS Row, * from news
 
)
SELECT * FROM temptbl where Row between @startIndex and @endIndex
END

你可能感兴趣的:(Go)