I am doing some auditing to find out which tables are actually being used/referenced in SQL Server 2000 Database. I have an audit table with the following fields:
ID PK
OBjectName. The name of the table
OBjectType. The Object Type. Table
AuditDate. GetDate()
Initiator. SYS_USER
The Trigger I set on each table
CREATE TRIGGER MyTriger
on MyTableName
FOR INSERT UPDATE DELETE
INSERT MYAUDITTABLE(OBjectName, ObjectType,AuditDate,Initiator )
VALUES('MyTableName', 'Table',GetDate(), SYS_USER)
The problem is that the trigger fires for each batch insert, update and delete. My Audit Table is getting extremely large. If there is a batch insert of 100 000 records, the trigger fires 100 000. times. Is there a way, to force the trigger to fire once only regardless of the number of records that are being processed by the query?
I will appreciate any input on this
Thank you
ID PK
OBjectName. The name of the table
OBjectType. The Object Type. Table
AuditDate. GetDate()
Initiator. SYS_USER
The Trigger I set on each table
CREATE TRIGGER MyTriger
on MyTableName
FOR INSERT UPDATE DELETE
INSERT MYAUDITTABLE(OBjectName, ObjectType,AuditDate,Initiator )
VALUES('MyTableName', 'Table',GetDate(), SYS_USER)
The problem is that the trigger fires for each batch insert, update and delete. My Audit Table is getting extremely large. If there is a batch insert of 100 000 records, the trigger fires 100 000. times. Is there a way, to force the trigger to fire once only regardless of the number of records that are being processed by the query?
I will appreciate any input on this
Thank you