From the course: SQL Server Database Triggers

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

Challenge: Create a trigger

Challenge: Create a trigger - SQL Server Tutorial

From the course: SQL Server Database Triggers

Start my 1-month free trial

Challenge: Create a trigger

(upbeat music) - [Instructor] We've seen a couple of triggers that you can apply to data manipulation commands sent to SQL server tables. Now it's a good time to take a moment to try out what you've learned. In the Chapter One folder of the exercise files I've created a small script called ChallengeOne-Start.sql. It'll build a table structure to store product categories in the Kinetico TRG database. I'd like you to add three different triggers to the table. One will fill in the CreationDate whenever a new row is inserted into the table. The second trigger will update the LastModifiedDate column whenever a row is updated. And finally create a trigger that'll prevent any delete operations from removing rows from the table. When you're done creating your triggers, execute the lines in the script to test your solution and see if you get the expected results. This challenge should take you about 10 minutes to complete. Good…

Contents