--以下示例將D列插入到A之後,B、C之前
Create Table TEST(A Int,B Int,C Int)
Select * from TEST
GO
--允许系统标更新
EXEC sp_configure 'allow updates','1'
GO
Reconfigure With Override
GO
--添加D列
Alter Table TEST Add D Int
--更新B列顺序
Update syscolumns
Set ColID=5
Where Name='B' And ID=OBJECT_ID('TEST')
--更新D列顺序
Update syscolumns
Set ColID=2
Where Name='D' And ID=OBJECT_ID('TEST')
--禁用系统标更新
EXEC sp_configure 'allow updates','0'
GO
Reconfigure With Override
GO
Select * from TEST
GO
Drop Table TEST
--結果
/*
--插入D前
ABC
--插入D後
ADBC
*/
Create Table TEST(A Int,B Int,C Int)
Select * from TEST
GO
--允许系统标更新
EXEC sp_configure 'allow updates','1'
GO
Reconfigure With Override
GO
--添加D列
Alter Table TEST Add D Int
--更新B列顺序
Update syscolumns
Set ColID=5
Where Name='B' And ID=OBJECT_ID('TEST')
--更新D列顺序
Update syscolumns
Set ColID=2
Where Name='D' And ID=OBJECT_ID('TEST')
--禁用系统标更新
EXEC sp_configure 'allow updates','0'
GO
Reconfigure With Override
GO
Select * from TEST
GO
Drop Table TEST
--結果
/*
--插入D前
ABC
--插入D後
ADBC
*/