|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: 2 days ago @ 1:12 AM
Points: 82,
Visits: 134
|
|
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?
|
|
|
|
|
SSCrazy
      
Group: General Forum Members
Last Login: Thursday, June 13, 2013 7:03 AM
Points: 2,562,
Visits: 3,453
|
|
sej2008 (1/21/2013) I want to understand since dml triggers are using data modification statements are 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---------- While 1 = 1 (Learning SQL....) Click to get fast response of your post
|
|
|
|
|
Old Hand
      
Group: General Forum Members
Last Login: Today @ 2:46 AM
Points: 385,
Visits: 1,418
|
|
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;
The SQL Guy @ blogspot
About Me
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: 2 days ago @ 1:12 AM
Points: 82,
Visits: 134
|
|
Thanks I for your example it did help to understand practically.
|
|
|
|
|
SSC Journeyman
      
Group: General Forum Members
Last Login: 2 days ago @ 1:12 AM
Points: 82,
Visits: 134
|
|
Thanks
|
|
|
|
|
SSC-Dedicated
           
Group: General Forum Members
Last Login: Today @ 3:25 AM
Points: 38,073,
Visits: 30,366
|
|
sej2008 (1/21/2013) 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?
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 2008, MVP SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
We walk in the dark places no others will enter We stand on the bridge and no one may pass
|
|
|
|