SQL Server Triggers

| Total Words: 414

Triggers are stored procedures which are fired when data is modified in an underlying table. They can evaluate data being added to a table for validation purposes, or can make changes in that or other fields depending on the value of that data. You can use them even to execute a separate stored procedure, or to roll back a data modification or an entire transaction.

In earlier versions of SQL Server, triggers were used to maintain referential integrity. In current versions, constraints and foreign keys are used to accomplish much of those tasks, but triggers are still used to accomplish more complex tasks than that are available to the built in newer tools, such as complex column constraints, evaluation of tables in other databases, complicated defaults, or cascading routines involving multiple changes in multiple tables.

Triggers are created in the Enterprise Manager, or in the Query Analyzer through the object browser. There are also templates for triggers in the Query Analyzer (EditInsert Trigger). Triggers can be created with the following syntax:

CREATE TRIGGER trigger_name
ON { table view }
[ WITH ENCRYPTION ]
{
{ { FOR...

To view and download this full PLR article, you must be logged in. Registration is completely free. Once you create your account, you will be able to browse, search & downlod from our PLR articles database of over "1,57,897+" on 1,000's of niches and 200+ categories without paying a penny. Click here to signup...

** PLR to VIDEO: Create Awesome Videos From PLR Articles... FAST!...