0

i want to fill a column id in my table x.info in order 1,2,3,4 etc based on another column of the same table transaction_date

Example

quantity     transaction_date   id

6            10/02/2000     
4            11/04/2000     
9            05/05/2000    
7            18/05/2000

after running the query i need the column id filled as below

quantity     transaction_date   id

6            10/02/2000          1    
4            11/04/2000          2     
9            05/05/2000          3    
7            18/05/2000          4

i.e., column id filled in order 1,2,3,... in the ascending order of transaction_date... Please help i am newbie

RiggsFolly
  • 89,708
  • 20
  • 100
  • 143
  • You tagged the question Sql Server 2000. This version of Sql Server is no longer supported, and no longer gets security patches, even when critical vulnerabilities are discovered. It's irresponsible to continue using it. – Joel Coehoorn Apr 25 '14 at 13:37
  • Filling your ID column have no relation with the select statement. I mean you can directly fill the ID column probably. – Rahul Apr 25 '14 at 13:41
  • write a cursor, increment a counter variable and update each row individually. it will take a while. too bad ROW_NUMBER() isn't available in SQL Server 2000. you could look in to http://stackoverflow.com/questions/4081753/sql-server-row-number-on-sql-server-2000 – KM. Apr 25 '14 at 14:05

0 Answers0