I am using SQL2000 and I would like to join two table together based on their positions
For example consider the following 2 tables:
table1 ------- name -
Do you have anything that guarantees ordering of each table?
As far ax I know, SQL server does not make any promise on the ordering of a resultset unless the outer query has an order by clause. In your case you need Each table to be ordered in a deterministic manner for this to work.
Other than that, in SQL 2000, as answered before me, a temp table and two cursors seem like a good answer.
Update: Someone mentioned inserting both tables into temp tables, and that it would yield better performance. I am no SQL expert so I defer to those who know on that front, and since I had an up-vote I thought you should investigate those performance considerations. But in any case, if you do not have any other information in your tables than what you showed us I'm not sure you can pull it off, ordering-wise.