A little more concretely:
There is a special 'identity(n)' operator that you can use with select into for this purpose. Note that while it looks like a function, it can't be used as one in a straight select, only in select into.
1> select row_number = identity(32), name into #mytemptable from syslogins
2> go
(10 rows affected)
1> select * from #mytemptable
2> go
row_number name
----------------------------------- ------------------------------
1 a
2 aaa
3 jjj
4 jjjj
5 jjjjj
6 joe
7 joeuser
8 log
9 probe
10 sa
(10 rows affected)
1> select name, identity(32) from syslogins
2> go
Msg 156, Level 15, State 2:
Server 'REL157SP1xx_bret_sun2', Line 1:
Incorrect syntax near the keyword 'identity'.
1>