首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

关于 identity(int,1,1) 的疑难有关问题

2012-01-29 
关于 identity(int,1,1) 的疑难问题!selectpxidentity(int,1,1),*intotestfromtorderbys,r,id在使用ident

关于 identity(int,1,1) 的疑难问题!
select   px   =   identity(int,1,1)   ,   *   into   test   from   t
order   by   s   ,   r   ,   id  
在使用   identity(int,1,1)   是的到的为什么不是排序后的呢?order   by好像没有什么效果阿!

[解决办法]
select px = identity(int,1,1) , * into test from (select * from t order by s,r,id) a
[解决办法]
select px = identity(int,1,1) , * into test from t order by s , r , id
这样应该是可以的.

热点排行