Created
August 25, 2015 20:00
-
-
Save thanley11/fc267d28ae3c5476e06b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE [db] | |
GO | |
SET ANSI_NULLS ON | |
GO | |
SET QUOTED_IDENTIFIER ON | |
GO | |
ALTER PROCEDURE [dbo].[load_pids] | |
@Skip AS INT, | |
@Take AS int | |
AS | |
BEGIN | |
SELECT * FROM ( | |
SELECT COUNT(mt.pid) OVER() [TotalRows], ROW_NUMBER() OVER(ORDER BY mt.prid) AS [RowNum], mt.pid, mt.repo_name | |
from db.dbo.mytable mt | |
) AS [InsideQuery] | |
WHERE [RowNum] BETWEEN (@Skip * @Take) + 1 AND (@Skip + 1) * @Take | |
END |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment