I have a sample input table as
Also I have a tally table as under
In Sql Server 2005 if I do as
I get the output as
But I am restricted to Sql server 2000. How can I get the same output?
(comments are locked)
|
can you move the data into another temp table with an identity column
Is there any other way without using the identity column? I have tried this query though the answer I am getting is wrong SELECT name, (SELECT COUNT(*) FROM @input AS i2 WHERE i2.Name <= i1.Name) As rn FROM @input AS i1
Jun 27, 2011 at 02:42 AM
learner
You will struggle to try and get unique row numbers from the name as it is not unique. The code you have tried works if all the elements are unique - and is actually the way I would have done this - but there is nothing in the data to uniquely identify the row
Jun 27, 2011 at 02:47 AM
Kev Riley ♦♦
(comments are locked)
|