1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
| CREATE TRIGGER [dbo].[VD_Date_lendemain1]
ON [dbo].[Communication]
AFTER INSERT,UPDATE
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
-- Insert statements for trigger here
INSERT INTO [dbo].[Comm_Link]
(
[CmLi_Comm_UserId],
[CmLi_Comm_CommunicationId],
[CmLi_CreatedBy],
[CmLi_CreatedDate],
[CmLi_UpdatedBy],
[CmLi_UpdatedDate],
[CmLi_Comm_CompanyId],
[CmLi_Comm_PersonId]
)
SELECT
CmLi_Comm_UserId = Comm_CreatedBy,
CmLi_Comm_CommunicationId = Comm_CommunicationId,
CmLi_CreatedBy = Comm_CreatedBy,
CmLi_CreatedDate = Comm_ToDateTime,
CmLi_UpdatedBy = Comm_UpdatedBy,
CmLi_UpdatedDate = Comm_UpdatedDate,
CmLi_Comm_CompanyId = Oppo_PrimaryCompanyId,
CmLi_Comm_PersonId = Oppo_PrimaryPersonId
FROM dbo.Communication inner join dbo.opportunity ON Oppo_OpportunityId = Comm_OpportunityId
inner join dbo.Comm_Link ON Comm_CommunicationId = CmLi_Comm_CommunicationId
WHERE Comm_Action = 'Meeting'
END |
Partager