There are times when tables have no unique numerical identifiers to use. I was in one such situation when we had a heap with 25 million rows and no identifier row. In these cases the row_number() function can be used.
select * from
select row_number() over (order by [name]) as row_num,name
The row_number() has to be used with the over(). The over() tells which ordered column will have the row numbers associated with it. Note that we are using a nested select statement.