From the course: SQL Server Database Triggers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Challenge: Create a DDL trigger - SQL Server Tutorial
From the course: SQL Server Database Triggers
Challenge: Create a DDL trigger
(upbeat music) - [Instructor] Now that you've seen how to access event information using the event data function. I'd like you to apply that to a new challenge, use the ChallengeTwo-Start script file to set up the challenge. Your task is to create a trigger that will fire for all table level DDL events in the Kinetico TRG database. The trigger will write information from the EVENTDATA function to an event capture table about these elements: EventType, UserName, ObjectName, and TSQLCommand. Finally run the queries provided in the script to test your solution and see if the expected rows were correctly saved into your event capture table. I estimate that this challenge should take about 10 minutes or less to complete. In the next movie I'll walk through my solution. Good luck.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.