触发本触发器的条件是:插入的语句的projectid(企业编号)>0而且cdxm(长贷项目)=‘借款金额’时,同时在本表中插入一条projectid和marketid、cdje(长贷金额)相同,marketyear=插入的marketyear(发生年份)+插入的zq(帐期),长贷项目为‘应还金额’的数据记录。
Code
if
exists(
select projectid
from inserted
where projectid>0)
begin
insert
into cd
select projectid,marketid,
convert(
int,marketyear)+
convert(
int,zq),
'应还金额',cdje,0
from inserted
where cdxm=
'借款金额'
and projectid>0
end