SQL Server Performance

question related to Ranking functions

Discussion in 'SQL Server 2005 General Developer Questions' started by shankbond, Apr 21, 2010.

  1. shankbond New Member

    Hi,
    This is not much related to sql server 2005; but I hope some one among You might have encountered such problem in his/ her experience.
    I am developing an application based in C#/ Asp.net; I have a gridview control.
    through the page changing event I can get the page requested for , and the page size.
    So I use a stored procedure as:
    CREATE PROCEDURE dbo.test
    @pagenumber INT,
    @pagesize INT
    AS
    BEGIN
    SELECT * FROM
    (
    SELECT ROW_NUMBER() OVER(ORDER BY (EmployeeID)) AS column1,* FROM
    (SELECT * FROM HumanResources.vEmployee)t)sub
    WHERE sub.column1>(@pagenumber-1)*@pagesize AND sub.column1<=(@pagenumber)*@pagesize
    END
    --I have made this procedure on the fly so can not guarantee the syntax[:p]
    So the question:
    Is this the best way to restrict the records or there are some other functions besides ROW_NUMBER()
    Any help shall be appreciated.
  2. shankbond New Member

    Got this interesting article.
    http://www.sql-server-performance.com/articles/per/ranking_functions_performance_p1.aspx

Share This Page