an example,create table gs(a int,b int,c as a+b)insert into gs(a,b) select 1,2 union all select 3,5select * from gs/* a b c ----------- ----------- ----------- 1 2 3 3 5 8(2 row(s) affected) */--备份数据 select * into #gs from gs--删除公式 drop table gs create table gs(a int,b int,c int)--导入数据 insert into gs(a,b,c) select * from #gs--结果 select * from gs/* a b c ----------- ----------- ----------- 1 2 3 3 5 8(2 row(s) affected) */
方法2,create table gs(a int,b int,c as a+b)insert into gs(a,b) select 1,2 union all select 3,5select * from gs/* a b c ----------- ----------- ----------- 1 2 3 3 5 8(2 row(s) affected) */ alter table gs add c2 intupdate gs set c2=calter table gs drop column csp_rename 'gs.c2','c','column'--结果 select * from gs/* a b c ----------- ----------- ----------- 1 2 3 3 5 8(2 row(s) affected) */
select 1,2 union all
select 3,5select * from gs/*
a b c
----------- ----------- -----------
1 2 3
3 5 8(2 row(s) affected)
*/--备份数据
select * into #gs from gs--删除公式
drop table gs
create table gs(a int,b int,c int)--导入数据
insert into gs(a,b,c)
select * from #gs--结果
select * from gs/*
a b c
----------- ----------- -----------
1 2 3
3 5 8(2 row(s) affected)
*/
select 1,2 union all
select 3,5select * from gs/*
a b c
----------- ----------- -----------
1 2 3
3 5 8(2 row(s) affected)
*/
alter table gs add c2 intupdate gs set c2=calter table gs drop column csp_rename 'gs.c2','c','column'--结果
select * from gs/*
a b c
----------- ----------- -----------
1 2 3
3 5 8(2 row(s) affected)
*/