先判断是否存在,存在就更新
IF EXISTS(SELECT 1 FROM sys_emp a,inserted b join hr_emp_title c on b.empid = c.empid)
BEGIN
update c
set c.title_code = b.title_code
from inserted b join hr_emp_title c on b.empid = c.empid
END
不存在就插入
ELSE
BEGIN
insert into hr_emp_title(empid,title_code) select empid ,title_code from inserted;
END
温馨提示:答案为网友推荐,仅供参考