Skip to Content
SQL Server 2014 Development Essentials
book

SQL Server 2014 Development Essentials

by Basit A. Masood-Al-Farooq
July 2014
Intermediate to advanced
214 pages
4h 47m
English
Packt Publishing
Content preview from SQL Server 2014 Development Essentials

Creating and using triggers

A trigger is a special type of stored procedure that fires (executes) in response to an event. We typically use triggers to maintain data integrity rules that are too complicated to implement through constraints and referential integrity. We also use triggers to:

  • Implement referential actions, such as cascading deletes
  • Maintain an audit trail of changes
  • Perform administrative tasks such as auditing and regulating database operations
  • Compare data before and after modification
  • Implement custom error messages

Triggers cannot support parameters and should not return values or result sets.

Microsoft SQL Server 2014 has two basic trigger types: DML triggers and DDL triggers.

Note

You can write DDL and DML triggers as Transact-SQL ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

What's New in SQL Server 2012

What's New in SQL Server 2012

Rachel Horder
Mastering SQL Server® 2008

Mastering SQL Server® 2008

Michael Lee, Gentry Bieker
Microsoft® SQL Server 2012 Unleashed

Microsoft® SQL Server 2012 Unleashed

Ray Rankins, Paul T. Bertucci, Chris Gallelli, Alex T. Silverstein

Publisher Resources

ISBN: 9781782172550Supplemental Content