-4

My query:

select 
    row_number() over(partition by line_no order by line_NO) as orce 
from tx_hsa_summ

This is my query when ever I use the over function I keep getting this error

Msg 195, Level 15, State 10, Line 1
'row_number' is not a recognized function name.

and this is my db version

Microsoft SQL Server 2000 - 8.00.2305 (Intel X86) May 14 2012 16:24:50 
Copyright (c) 1988-2003 Microsoft Corporation Enterprise Edition 
   on Windows NT 5.2 (Build 3790: Service Pack 2)

pls help me resolve this. Thanks in advance

Mahmoud Gamal
  • 78,257
  • 17
  • 139
  • 164
sentil kumar
  • 97
  • 2
  • 7

1 Answers1

6

There is no ROW_NUMBER() function in SQL Server 2000, it was presented in SQL Server 2005.

Mahmoud Gamal
  • 78,257
  • 17
  • 139
  • 164
  • So how to overcome this pro? – sentil kumar Mar 25 '13 at 09:23
  • @sentilkumar - You have to use other logic to simulate the ranking, if you search in Google you would find other alternative for it in SQL Server 2000 using temp tables. See [this](http://sqlserverplanet.com/sql-2000/simulate-row_number-in-sql-2000), and [this answer](http://stackoverflow.com/a/5705937/722783). – Mahmoud Gamal Mar 25 '13 at 09:43