Oracle :
row_number over(order by code)
SQLServer2000:
select ( select count(*)
from table_name p1
where p1.id<= p2.id) as rowNumber,
* from table_name p2
order by rowNumber
SQLServer2005+:
Row_number()
MySQL:
@ i = @ i +1
SELECT @i := @i + 1 uindex,t.name
FROM (SELECT @i := -1) AS i,table_name t