From the course: Developing Microsoft SQL Server 2016 Databases
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Use DML triggers to verify data - SQL Server Tutorial
From the course: Developing Microsoft SQL Server 2016 Databases
Use DML triggers to verify data
- [Instructor] Data Modification Language triggers, or DML triggers for short, are yet another tool in the data integrity toolkit. With DML triggers, you can fire off a programmatic response to an INSERT, UPDATE, MERGE, or DELETE statement when working with data in a table. The nice thing about them, is that they can reach out to other objects in the database and process a more complex logical routine than the other data integrity techniques that we've seen. Also, instead of simply allowing or rejecting a proposed value, they can modify data on their own to keep everything in sync. Let's take a look at how this can work here inside of Management Studio. And I'll start by creating a new database called DMLTrigger that we'll work inside of. Next, we'll create the tables that will set up the scenario. The first table will be called products, and it will be on the dbo schema. It will include the product ID field, which will be…
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.