declare @t table([name] varchar(10))
insert into @t select 'aa'
insert into @t select 'bb'
insert into @t select 'cc'
insert into @t select 'dd'
insert into @t select 'teqeq'
select [id]=identity(int,1,1),* into # from @t -- 第一种
select [name] from # where id=5
drop table #
select [name] from (select *,id=(select count(1) from @t where [name]<=a.[name]) from @t a)b where b.id=5 --第二种
第一种不能插入表的所有列(特指自增那列)
第二种是查询的时候会出现多个记录~ 奇怪~ 暂时看不明~