将某列数据更新为数据序列
主表
create table la
(
id int identity(0, 1 )
, name varchar(10)
,ids int
)
再插入一些数据
insert into la
( name
)
select 'a'
union select 'b'
union select 'bsd'
union select 'bsf'
union select 'bsf'
union select 'bf'
union select 'basdf'
union select 'ba'
union select 'bdsf'
序列表
select cast( id as varchar) as id , identity(int, 0 , 1 ) idd into lb from la
再然后更新
update la
set ids = lb.idd
from la , lb
where la.id = lb.id
主表
create table la
(
id int identity(0, 1 )
, name varchar(10)
,ids int
)
再插入一些数据
insert into la
( name
)
select 'a'
union select 'b'
union select 'bsd'
union select 'bsf'
union select 'bsf'
union select 'bf'
union select 'basdf'
union select 'ba'
union select 'bdsf'
序列表
select cast( id as varchar) as id , identity(int, 0 , 1 ) idd into lb from la
再然后更新
update la
set ids = lb.idd
from la , lb
where la.id = lb.id
浙公网安备 33010602011771号