Triggers
I have an INSTEAD OF DELETE trigger which, rather than deleting a row, resets an IsValid flag in that row.
This process causes my BEFORE UPDATE trigger to be called (as it is doing an update). However, the BEFORE UPDATE trigger is giving error Msg 208, Invalid object name 'UPDATED' when I try an update the ModificationDate column.
Can somebody explain why? Alternatively, is there a way to prevent the INSTEAD OF DELETE trigger calling the BEFORE UPDATE trigger when it does the update of the InActive flag? At least then I can do all of the updates in the INSTEAD OF DELETE trigger.
INSTEAD OF DELETE
UPDATE
[dbo].[myTable]
SET
[dbo].[myTable].[IsValid] = 0
FROM
DELETED
WHERE
DELETED.[Id] = [dbo].[myTable].[Id];
BEFORE UPDATE
UPDATE
[dbo].[myTable]
SET
[dbo].[myTable].[ModifiedDate] = GETDATE()
FROM
UPDATED
WHERE
UPDATED.[Id] = [dbo].[myTable].[Id];
umm, I'm assuming my BEFORE UPDATE trigger is not calling itself (recursive)?

