ranking functionality in SQL 2000

  • Hi,

    I have used ROW_NUMBER() ranking function in a procedure (SQL 2008) for filtering purpose.

    Now I want to do the same functionality in SQL 2000.

    How to do this?

    Thanks

    VinothKumar.k

  • The closest equivalent would be create a temptable with an identity column.

    Naturally , that will not support the over clause though



    Clear Sky SQL
    My Blog[/url]

  • Hi

    There is no such options in 2000

    In 2000 you can use IDENTITY (data_type [ , seed , increment ] ) .Is used only in a SELECT statement with an INTO table clause to insert an identity column into a new table.

    It is somewhat as Row_number() with CTE

    USE AdventureWorks;

    GO

    --- 2005/8

    WITH OrderedOrders AS

    (

    SELECT SalesOrderID, OrderDate,

    ROW_NUMBER() OVER (ORDER BY OrderDate) AS 'RowNumber'

    FROM Sales.SalesOrderHeader

    )

    SELECT *

    FROM OrderedOrders

    WHERE RowNumber BETWEEN 50 AND 60;

    --- 2000

    Select IDENTITY(int, 1,1) AS RowNumber,* into #Tmp from Sales.SalesOrderHeader

    ORDER BY OrderDate

    Select * from #Tmp WHERE RowNumber BETWEEN 50 AND 60;

    Thanks

    Parthi

    Thanks
    Parthi

  • hi

    If it is possible group by Orderdate

    That’s means order date wise row number

  • Hi

    The ranking functions in SQL like Row_Number, Dense_rank, Rank are not supported in the 2000 version. It was introduced in 2005 version.

  • Hi

    Pls refer this link for a solution

    http://www.codeproject.com/KB/reporting-services/Rank_Query.aspx

  • vinoth-750003 (12/8/2010)


    hi

    If it is possible group by Orderdate

    That’s means order date wise row number

    Not without a cursor / looping solution



    Clear Sky SQL
    My Blog[/url]

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply