--创建一个临时表:
create table #(name varchar(20))insert into #
select 'a'
union all
select 'd'
union all
select 'z'select * from # order by name desc
--显示如下:
z
d
a
--使用identity,插入到另外一张临时表:
select identity(int,1,1) as id, *
into #a
from #
order by name descselect * from #a--显示如下:
id name
1 z
2 d
3 a它为什么不是出现如下结果:
id name
3 z
2 d
1 a请教各位大侠!!!
create table #(name varchar(20))insert into #
select 'a'
union all
select 'd'
union all
select 'z'select * from # order by name desc
--显示如下:
z
d
a
--使用identity,插入到另外一张临时表:
select identity(int,1,1) as id, *
into #a
from #
order by name descselect * from #a--显示如下:
id name
1 z
2 d
3 a它为什么不是出现如下结果:
id name
3 z
2 d
1 a请教各位大侠!!!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货