SQL SERVER触发器
时间: 2023-09-28 12:06:43 浏览: 101
SQL Server触发器是一种与表事件相关的特殊存储过程,用于保证数据完整性和实施业务规则。触发器是在对表进行操作(插入,删除,更新)时自动激活执行的。触发器可以用于实现检查约束、维护冗余数据、维护外键列数据等功能。触发器有创建、删除和修改的语法。创建触发器的语法是"create trigger trigger_name on {table_name | view_name} for | after | instead of delete | insert | update as sql_statement",删除触发器的语法是"drop trigger trigger_name",修改触发器的语法是"alter trigger trigger_name on {table_name | view_name} for | after | instead of delete | insert | update as sql_statement"。登录触发器是一种特殊类型的触发器,它会在与SQL Server实例建立用户会话时触发。登录触发器在用户身份验证完成后,但用户会话实际建立之前激发。登录触发器可以用于在登录事件发生时执行存储过程并记录相关信息。<em>1</em><em>2</em><em>3</em>
#### 引用[.reference_title]
- *1* *3* [SQL Server触发器(附有实例)](https://blog.csdn.net/weixin_45763353/article/details/116852556)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item]
- *2* [sql server中的触发器](https://blog.csdn.net/guokeeiron/article/details/129970903)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}} ] [.reference_item]
[ .reference_list ]
阅读全文