∏三毛

昔者庄周梦为胡蝶,栩栩然胡蝶也。自喻适志与!不知周也。

俄然觉,则蘧蘧然周也。不知周之梦为胡蝶与?胡蝶之梦为周与?

周与胡蝶则必有分矣。此之谓‘物化’。

create table t1(c1 int ,c2 int)
insert t1(c1,c2) values(5,10)
insert t1(c1,c2) values(3,20)
insert t1(c1,c2) values(4,30)
insert t1(c1,c2) values(2,40)
insert t1(c1,c2) values(1,50)

select * from t1

c1          c2
----------- -----------
5           10
3           20
4           30
2           40
1           50

update t1 set t1.c1 =t.c1
from
(
select
row_number() over (order by c2) as c1,
c2
from t1
) as t
where t.c2=t1.c2

select * from t1

c1          c2
----------- -----------
1           10
2           20
3           30
4           40
5           50

drop table t1

 

参考:http://blog.csdn.net/Star8816/archive/2008/10/08/3033888.aspx

posted on 2009-01-22 14:57  π三毛  阅读(477)  评论(0编辑  收藏  举报