level 3
-----先加一个id2字段
-----将id数据写入id2
update 表 set id = id2;
-----根据id2重写id
update 表 set id = id2+1 where id2%2<>0 and id2<>max(id2);
update 表 set id = id2-1 where id2%2=0 and id2<>max(id2);
2019年08月21日 17点08分
3
level 3
create table #tmp (
id int identity(1,1),
nameCN varchar(10))
insert into #tmp
select 'a' union all
select 'b' union all
select 'c' union all
select 'd' union all
select 'e' union all
select 'f' union all
select 'g' union all
select 'h' union all
select 'i'
update t1
set t1.nameCN=case when t1.id%2>0 then isnull(t2.nameCN,t1.nameCN) else t3.nameCN end
from #tmp t1
left join #tmp t2 on t1.id+1=t2.id
left join #tmp t3 on t1.id-1=t3.id
2019年09月09日 09点09分
4