I have created this trigger below to audit updates and inserts to my table, I also want any updates or inserts to be copied to another table called labdata, and then logged in my audit table. how would i do this?
this is what i have so far and it works for what i have so far.
CREATE TRIGGER AuditSamples
ON dbo.[Samples Received]
AFTER INSERT, UPDATE
--NOT FOR REPLICATION
DECLARE @Operation char(6)
IF EXISTS(SELECT * FROM deleted)
SET @Operation = 'Update'
SET @Operation ='Insert'
INSERT INTO dbo.SamplesAudit(DateChanged,TableName,UserName,Operation)
SELECT GetDate(),'[Samples Received]', suser_sname(),
--End of Trigger