Skip to content

Instantly share code, notes, and snippets.

Created July 11, 2013 18:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/5977962 to your computer and use it in GitHub Desktop.
Save anonymous/5977962 to your computer and use it in GitHub Desktop.
CREATE PROCEDURE [dbo].[getClients]
@filterString varchar(25),
@start int,
@limit int
AS
BEGIN
SET NOCOUNT ON;
SELECT TOP (@limit)
clientId,
clientName
FROM
(
SELECT ROW_NUMBER() OVER (ORDER BY clientName) as RowNum, clientId, clientName
FROM dbo.Clients
WHERE clientName like @filterString + '%'
) as RowConstrainedResult
WHERE
rowNum > @start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment