34,576
社区成员
发帖
与我相关
我的任务
分享
create table test(id int, name varchar(30))
go
insert into test(name) select top 10 name from sysobjects
go
select * from test
go
with m as (
select ROW_NUMBER() over(order by getdate()) rn , * from test
)
update m set id = rn
go
select * from test
go
drop table test
go
(10 行受影响)
id name
----------- ------------------------------
NULL sysrscols
NULL sysrowsets
NULL sysallocunits
NULL sysfiles1
NULL syspriorities
NULL sysfgfrag
NULL sysphfg
NULL sysprufiles
NULL sysftinds
NULL sysowners
(10 行受影响)
(10 行受影响)
id name
----------- ------------------------------
1 sysrscols
2 sysrowsets
3 sysallocunits
4 sysfiles1
5 syspriorities
6 sysfgfrag
7 sysphfg
8 sysprufiles
9 sysftinds
10 sysowners
(10 行受影响)