January 21, 2013 at 12:24 am
I want to understand since dml triggers are using data modification statements
are they logged in log file and if yes when?
and can we log those trigger events in auditing in system event log in sql 2008?
January 21, 2013 at 1:15 am
sej2008 (1/21/2013)
I want to understand since dml triggers are using data modification statementsare they logged in log file and if yes when?
i dont think they are differently/specially get treated for transational logging. their logging works same as other transactions.
-------Bhuvnesh----------
I work only to learn Sql Server...though my company pays me for getting their stuff done;-)
January 21, 2013 at 4:58 am
USE [AdventureWorks];
GO
CREATE TABLE TestTrigger (ID INT)
GO
CREATE TABLE TestTriggerAudit (ID INT)
GO
CREATE TRIGGER trTestTrigger ON TestTrigger
FOR INSERT
AS
INSERT INTO TestTriggerAudit SELECT * FROM inserted;
GO
INSERT INTO TestTrigger VALUES (1);
GO
CHECKPOINT;
INSERT INTO TestTrigger VALUES (22);
DBCC LOG('AdventureWorks', 3);
DROP TABLE TestTrigger;
DROP TABLE TestTriggerAudit;
January 21, 2013 at 7:46 am
Thanks I for your example it did help to understand practically.:-)
January 21, 2013 at 7:47 am
Thanks:-)
January 21, 2013 at 7:55 am
sej2008 (1/21/2013)
I want to understand since dml triggers are using data modification statementsare they logged in log file and if yes when?
and can we log those trigger events in auditing in system event log in sql 2008?
Just one point...
The transaction log is not an audit log. It's not there so you can see what happened. If you want an audit log, then configure one using trace, extended events, CDC, change tracking or SQL Audit.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply