SELECT 
    (SELECT COUNT(*)
     FROM [table] AS t2
     WHERE t2.name <= t1.name) AS rowNum,
    id,
    name
FROM [table] t1
ORDER BY t1.name asc