- Ok, the first thing we're going to do…is in AdventureWorks 2014, expand…HumanResources.Employee table and…expand the triggers folder DEmployee,…I'm going to right-click that, Script Trigger as,…Create to, New Query Editor.…- Let's take a look at a couple triggers…that exist in AdventureWorks 2014.…And here I'm looking in HumanResourcesEmployee…under Triggers, I've got DEmployee Trigger.…
Now if you look, after our naming,…this is an Instead Of Trigger,…so Instead Of Delete, and Not For Replication,…meaning if we're replicating the database,…this won't be replicated.…So, Instead Of Delete, and we're declaring some variables.…Then we come down here and we see the interesting…part of the code which is after the Begin.…So, on Instead of firing at delete,…this block of code is going to execute.…We're going to raise an error and it says,…if you read this, you can't delete an employee,…you can only mark them as not current.…
So, Raise an Error, Passback, Begin Rollback Transaction.…You see a deletion.…Any crud operations are transactions.…
Author
Released
11/12/2015- Working with SQL Server development tools
- Designing database tables
- Utilizing schemas with tables
- Using constraints to enforce integrity
- Understanding how SQL stores and locates data
- Designing database views
- Working with stored procedures
- Using triggers to modify data
- Creating in-memory databases
Skill Level Intermediate
Duration
Views
Related Courses
-
Querying Microsoft SQL Server 2012
with Gerry O'Brien5h 34m Beginner -
SQL Server 2014: Installation and Administration
with Ron Davis3h 40m Intermediate
-
Introduction
-
Welcome43s
-
-
1. Working with SQL Server Development Tools
-
Managing projects with SSMS7m 30s
-
2. Designing Data Tables
-
Reviewing database normalization11m 23s
-
Introduction to designing tables10m 27s
-
Designing tables9m 12s
-
Altering tables2m 41s
-
-
3. Understanding the Concept of Constraints
-
4. Storage and Indexes
-
How SQL stores data7m 11s
-
5. Designing Views
-
Introducing views7m 28s
-
Creating and managing views2m 38s
-
-
6. Working with Stored Procedures
-
7. Performing Data Modification with Triggers
-
Understanding triggers4m 18s
-
Utilizing triggers4m 1s
-
-
8. In-Memory Databases
-
What is in-memory?9m 45s
-
In-memory: More details7m 5s
-
Creating in-memory tables2m 15s
-
In-memory stored procedures6m 52s
-
Migrating6m 3s
-
-
Conclusion
-
Next steps1m 13s
-
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.
CancelTake notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.
Share this video
Embed this video
Video: Utilizing triggers