/DotNetKicks/Database/_old/003.DotNetKicks.GetPagedSubmittedStoriesByUserIDAndHostID.SQL.2005.sql
SQL | 36 lines | 25 code | 10 blank | 1 comment | 0 complexity | a56f25bebb90f84bad79f6ce3bbe11be MD5 | raw file
Possible License(s): BSD-3-Clause, MPL-2.0-no-copyleft-exception
1USE [DotNetKicks] 2GO 3/****** Object: StoredProcedure [dbo].[Kick_GetPagedSubmittedStoriesByUserIDAndHostID] Script Date: 09/07/2007 17:27:57 ******/ 4SET ANSI_NULLS ON 5GO 6SET QUOTED_IDENTIFIER ON 7GO 8CREATE PROCEDURE [dbo].[Kick_GetPagedSubmittedStoriesByUserIDAndHostID] 9 @UserID int, 10 @HostID int, 11 @PageNumber int, 12 @PageSize int 13AS 14BEGIN 15 16DECLARE @StartRow int, @EndRow int 17SET @StartRow = (((@PageNumber - 1) * @PageSize) + 1); 18SET @EndRow = (@StartRow + @PageSize - 1); 19 20 21 22 23 24WITH SubmittedStories 25 AS (SELECT ROW_NUMBER() OVER (ORDER BY Kick_Story.CreatedOn DESC) AS 26 Row, dbo.Kick_Story.* 27 FROM 28 dbo.Kick_Story 29 WHERE dbo.Kick_Story.UserID=@UserID AND dbo.Kick_Story.HostID=@HostID) 30 31SELECT * FROM SubmittedStories 32WHERE ROW between @StartRow AND @EndRow 33 34 35 36END