Get startedGet started for free

Tracking table changes

You need to create a new trigger at the database level that logs modifications to the table TablesChangeLog.

The trigger should fire when tables are created, modified, or deleted.

This exercise is part of the course

Building and Optimizing Triggers in SQL Server

View Course

Exercise instructions

Create the new trigger following the company's requirements.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

-- Create the trigger to log table info
CREATE TRIGGER TrackTableChanges
ON ___
FOR CREATE_TABLE,
	___,
	DROP_TABLE
AS
	INSERT INTO ___ (EventData, ChangedBy)
    VALUES (EVENTDATA(), USER);
Edit and Run Code