USE [easdata]
GO
/****** Object: Trigger [dbo].[t_con_projectstart_upd] Script Date: 2019/2/19 22:39:26 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER TRIGGER [dbo].[t_con_projectstart_upd] ON [dbo].[T_CON_ProjectStart]
FOR UPDATE
as
BEGIN
IF UPDATE (FBillStatus)
begin
DECLARE @FID NVARCHAR( 255),@status nvarchar( 10),@oldstatus nvarchar( 10), @Fnumber NVARCHAR( 255),
@fprojectcode NVARCHAR( 255),@fpersonid NVARCHAR( 255),@FCreatorID NVARCHAR( 255)
select @FID =FID, @status =fbillstatus ,@fprojectcode=fprojectcode,@FCreatorID =FCreatorID FROM inserted
select @fpersonid =fpersonid from T_PM_User where fid = @FCreatorID
if (@status ='1')
if not exists(select fnumber from T_BD_Project where fnumber = @fprojectcode)
insert into T_BD_Project(
fid,
fname_l2,fnumber,fisleaf,flevel,flongnumber,ftype,fstatus,FScheduleStartDate,FSchedulEndDate,
FCreatorID,FCreateTime,
FLastUpdateUserID,FLastUpdateTime,
FControlUnitID,FDisplayName_L2,FIsListItem,
FCompanyID,FIsSysCreate,fisprostart,FPrjManagerID
)
select
[dbo].[newbosid]('DADE05EE') newfid,
fprojectname,fprojectcode,1 fisleaf,1 flevel,fprojectcode,0 ftype,1 fstatus,fstartdate,fenddate,
FCreatorID,FCreateTime,
FLastUpdateUserID,FLastUpdateTime,
FControlUnitID,fprojectname,1 FIsListItem,
FControlUnitID,0 FIsSysCreate,1 fisprostart, @fpersonid
FROM t_con_projectstart where fid =@fid;
END;
END
在二开单据点击审核的时候 ,向系统中的一个表中插入数据