34,576
社区成员
发帖
与我相关
我的任务
分享
Create trigger tr_A_insert on A
instead of insert
as
set nocount on;
insert A(A1,A2,A3 )
select A1,A1,A3 from inserted
if object_id('tb','U') is not null
drop table tb
go
create table tb
(
A1 varchar(10),
A2 AS A1,
A3 varchar(10)
)
go
insert into tb (A1,A3) values ('1','3')
select * from tb
/*
A1 A2 A3
---------- ---------- ----------
1 1 3
(1 行受影响)
*/
alter table t drop column A2
alter table t add A2 as A1
alter table t drop column b
alter table t add b as a