解释SQL中的触发器 [英] explain triggers in sql

查看:77
本文介绍了解释SQL中的触发器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友.

我想了解触发器.

它用于哪个位置,并且仅用于桌子.

我们可以在SP

Hi Friends.

I want to know about triggers.

Which Place it is used and is it only for table .

can we apply triggers on SP

推荐答案

定义:
触发器是一种特殊的存储过程,当数据库服务器中发生事件时,它会自动执行.当用户尝试通过数据操作语言(DML)事件修改数据时,将执行DML触发器. DML事件是表或视图上的INSERT,UPDATE或DELETE语句.

在需要在插入,更新和删除操作时执行任何计算的情况下,可以使用触发器.
例如:如果要删除,则要在另一个表中添加相同的值以保持历史记录.

触发器不能手动调用,它将自动执行.

您不能在SP上使用触发器.

有关更多详细信息,请参见以下链接:

http://msdn.microsoft.com/en-us/library/ms189799.aspx [ ^ ]

http://www.databasejournal.com/features/mssql/article.php/3837541/DML-Triggers-in-SQL-Server-2008.htm [
Definition:
A trigger is a special kind of stored procedure that automatically executes when an event occurs in the database server. DML triggers execute when a user tries to modify data through a data manipulation language (DML) event. DML events are INSERT, UPDATE, or DELETE statements on a table or view.

You can use triggers in a situation where you need to perform any calculation at the time of insert, update and delete operation.
For eg: In case of delete if you want add the same value in another table to maintain history.

Triggers can not be invoked manually, it will execute automatically.

You can not use triggers on SP.

For more details please refer below links:

http://msdn.microsoft.com/en-us/library/ms189799.aspx[^]

http://www.databasejournal.com/features/mssql/article.php/3837541/DML-Triggers-in-SQL-Server-2008.htm[^]

Regards
Praveen


对Google友好,请先尝试在Google搜索,
这里有一些学习链接:
http://www.kodyaz.com/articles/sql-trigger- example-in-sql-server-2008.aspx [ ^ ]

http://www.go4expert.com/forums/showthread.php?t=15510 [ ^ ]

以及来自Google的更多信息.
希望对您有帮助
Be friendly to Google and try to search there first ,
here are few links to learn :
http://www.kodyaz.com/articles/sql-trigger-example-in-sql-server-2008.aspx[^]

http://www.go4expert.com/forums/showthread.php?t=15510[^]

and many more from google .
hope this helps


请参考以下主题:

关于CP的好文章:
触发器-Sql Server [ SQL触发器 [触发器简介-第一部分 [探索SQL Server触发器 [
Please refer following threads:

A good article on CP:
Triggers -- Sql Server[^]

This might help you more:
SQL triggers[^]
An Introduction to Triggers -- Part I[^]
Exploring SQL Server Triggers[^]


这篇关于解释SQL中的触发器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆