In SQL Server 2005, I have an update trigger on a table. The purpose of this trigger is to set or clear a DeactivatedDate field whenever the IsActive field is changed. Also to write an audit record keeping a record of the change. Here is an excerpt from the trigger:
Code:
DECLARE @prevIsActive BIT
DECLARE @newIsActive BIT
DECLARE @id BIGINT
SELECT @newIsActive = IsActive, @id = RecordId
FROM