首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > SQL Server >

sql2005触发器有关问题,麻烦高手们讲解一下

2012-02-19 
sql2005触发器问题,麻烦高手们讲解一下.如create trigger t_nameon{table|view}{{for|after|instead of}{[

sql2005触发器问题,麻烦高手们讲解一下.
如create trigger t_name
on{table|view}
{{for|after|instead of}
 {[delete][,][insert][,][update]}
as sql_statement
}
其中FOR,AFTER,INSTEAD OF是什么意思?分别用于什么情形,他们的区别是什么.

[解决办法]
楼主首先要学习的是如何查阅在线帮助文档!


SQL Server 2005 Books OnlineINSTEAD OF
Specifies that the DML trigger is executed instead of the triggering SQL statement, therefore, overriding the actions of the triggering statements. INSTEAD OF cannot be specified for DDL or logon triggers.

At most, one INSTEAD OF trigger per INSERT, UPDATE, or DELETE statement can be defined on a table or view. However, you can define views on views where each view has its own INSTEAD OF trigger.

INSTEAD OF triggers are not allowed on updatable views that use WITH CHECK OPTION. SQL Server raises an error when an INSTEAD OF trigger is added to an updatable view WITH CHECK OPTION specified. The user must remove that option by using ALTER VIEW before defining the INSTEAD OF trigger.

热点排行