Create table student(id int ,name varchar(20) )Create table score(id int,score1 float,score2 float,score3 float)Create Trigger T_student on student
for insert
as
begin
insert into Score(id,score1,score2,score3)
select I.id,NULL,NULL,NULL from inserted I
endinsert into student values(1,'小明')select * from Score
--结果
id score1 score2 score3
--- -- --- -- ---
1 NULL NULL NULL
--删除测试环境
Drop table student ,Score
Drop Trigger T_student
for insert
as
begin
insert into Score(id,score1,score2,score3)
select I.id,NULL,NULL,NULL from inserted I
endinsert into student values(1,'小明')select * from Score
--结果
id score1 score2 score3
--- -- --- -- ---
1 NULL NULL NULL
--删除测试环境
Drop table student ,Score
Drop Trigger T_student
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货