通过系统表改列的物理顺序
if object_id('shiyan') is not null
drop table shiyan
go
create table shiyan(id int,name varchar(10),score int)
insert into shiyan select 1,'aa',80
sp_configure 'allow update',1
reconfigure with override
select a.name,colid from syscolumns a,sysobjects b where a.id=b.id and b.name='shiyan'
update syscolumns set syscolumns.colid=5 from sysobjects b where syscolumns.id=b.id and b.name='shiyan' and syscolumns.colid=1 --5可以随便改,只要比列的个数大的数就行
update syscolumns set syscolumns.colid=1 from sysobjects b where syscolumns.id=b.id and b.name='shiyan' and syscolumns.colid=3
update syscolumns set syscolumns.colid=3 from sysobjects b where syscolumns.id=b.id and b.name='shiyan' and syscolumns.colid=5
select a.name,colid from syscolumns a,sysobjects b where a.id=b.id and b.name='shiyan'
sp_configure 'allow update',0
reconfigure with override