March 2001
Intermediate to advanced
640 pages
14h 9m
English
Triggers are very much like stored procedures in that you must define them to store them in the database. It is also true that like a stored procedure, triggers are not executed when you create them. However, the difference between stored procedures and triggers comes in when they are executed. You control when a stored procedure is executed, whereas the SQL Server controls when a trigger is executed. To see how this works, we will execute an UPDATE statement on the Employees table for which we created a trigger in the previous section. The following UPDATE statement will make a minor change to the Employees table:
Update Employees Set City = 'New york' Where City = 'Seattle'
Results:
2 rows modified (This is the trigger ...
Read now
Unlock full access