USE [prd_customers]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[SetFollowUp]
ON [dbo].[DATA]
AFTER UPDATE
AS
SET NOCOUNT ON;
INSERT INTO dbo.FOLLOWUP (
RecordIdFK,
FullName,
Address,
City,
State,
Zip,
PhoneNumber,
eMail,
Notes)
SELECT
i.RecordId,
i.FullName,
i.Address,
i.City,
i.State,
i.Zip,
i.PhoneNumber,
i.eMail,
i.Notes
FROM inserted i
WHERE PhoneNumber is not null
USE [prd_customers]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[SetFollowUp]
ON [dbo].[DATA]
AFTER UPDATE
AS
SET NOCOUNT ON;
INSERT INTO dbo.FOLLOWUP (
RecordIdFK,
FullName,
Address,
City,
State,
Zip,
PhoneNumber,
eMail,
Notes)
SELECT
i.RecordId,
i.FullName,
i.Address,
i.City,
i.State,
i.Zip,
i.PhoneNumber,
i.eMail,
i.Notes
FROM inserted i
WHERE PhoneNumber is not null
and i.PhoneNumber in
(select PhoneNumber from inserted
except
select PhoneNumber from deleted)
USE [prd_customers]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[SetFollowUp]
ON [dbo].[DATA]
AFTER UPDATE
AS
SET NOCOUNT ON;
INSERT INTO dbo.FOLLOWUP (
RecordIdFK,
FullName,
Address,
City,
State,
Zip,
PhoneNumber,
eMail,
Notes)
SELECT
i.RecordId,
i.FullName,
i.Address,
i.City,
i.State,
i.Zip,
i.PhoneNumber,
i.eMail,
i.Notes
FROM inserted i
inner join
(select RecordId,PhoneNumber from inserted
except
select RecordId,PhoneNumber from deleted) changed
on changed.RecordId=i.RecordId
and changed.PhoneNumber=i.PhoneNumber
WHERE i.PhoneNumber is not null
However, generally speaking the asker SHOULD test the solutions in the order they are offered.
normally, the last response is the best one since no improvements or refinements are possible.Not true at all. Just go and check random closed questions and see how many of them have the last comment marked as solution.
Why do you think isn't working?