触发程序 (trigger) 是一种在数据库中,在对数据库有异动的动作时,先行拦截并处理的一种数据库对象,它大部份会设在数据表中,作为强制运行特定动作的程序,因此又称为 DML (数据操作语言) Trigger。
触发程序的好处有:
DML 触发程序可以分为数种:
DDL 触发程序范围就相当大,对数据库对象的异动大多都可捕捉,视数据库管理系统而定。
SQL Server 的 DML 触发程序可利用下列语法建立[1]:
CREATE TRIGGER reminder2 ON Sales.Customer AFTER INSERT, UPDATE, DELETE AS EXEC msdb.dbo.sp_send_dbmail @profile_name = 'AdventureWorks Administrator', @recipients = 'danw@Adventure-Works.com', @body = 'Don''t forget to print a report for the sales force.', @subject = 'Reminder';
| 数据库管理系统(DBMS) ( 查看 • 讨论 • 编辑 • 历史 ) | |
|
概念 |
|
|
数据库组件 |
SQL |
| 数据库管理系统的实施 | |
|
实施类型 |
|
|
数据库产品 |
|
stock | retire | vm
Why are we here?
All text is available under the terms of the GNU Free Documentation License
This page is cache of Wikipedia. History