I have two triggers After Insert or Update and Instead of Insert. It appears that the after trigger is not running or sending the correct data.
I have verified the correct operation of Z_UpdateStageTable stored procedure and the Instead of Insert trigger. Removing the Instead of Insert trigger doesn't have any affect. The After Insert, Update trigger was working correctly at one time, I haven't made any changes to it. I have tried deleting it and adding it, but it still doesn't run or have the correct data.
Any Ideas?
Instead of Insert:
ALTER TRIGGER [DeleteExistingFilter]
ON [dbo].[Z_MobileSyncFilters]
INSTEAD OF INSERT
AS
BEGIN
SET NOCOUNT ON;
DELETE FROM Z_MobileSyncFilters WHERE UserID = (SELECT UserID FROM INSERTED);
INSERT INTO Z_MobileSyncFilters
SELECT *
FROM INSERTED;
END
After Insert, Update:
TRIGGER [UpdateStageTable]
ON [dbo].[Z_MobileSyncFilters]
AFTER INSERT,UPDATE
AS
BEGIN
SET NOCOUNT ON;
DECLARE @AllWos AS VARCHAR(5000);
DECLARE @PmWos AS VARCHAR(5000);
DECLARE @RepWos AS VARCHAR(5000);
SET @AllWos = (SELECT AllWos FROM INSERTED);
SET @RepWos = (SELECT AllWos FROM INSERTED);
SET @PmWos = (SELECT AllWos FROM INSERTED);
EXEC Z_UpdateStageTable @AllWos;
EXEC Z_UpdateStageTable @RepWos;
EXEC Z_UpdateStageTable @PmWos;
END