触发器

--创建成功的触发器
create trigger trig_insert
on population_tab
after insert
as
begin
declare @salary int;
select @salary = (select b.population from population_tab b
where b.pop_id = (select max(a.pop_id) from population_tab a));
if not exists (select * from salary_tab c where c.before_salary = @salary)
insert into salary_tab(before_salary,after_salary) values(@salary,@salary);
end

posted on 2020-04-18 11:46  周公  阅读(93)  评论(0编辑  收藏  举报

导航