Tuesday, July 3, 2007

Triggers

Question:

Does SQL Server support before and after (pre and post) triggers?  What about "row" versus "set" triggers?

 

Answer:

 

SQL Server 7.0 and below only supports "after" triggers, however you can see what the "before" data was by using the logical tables 'inserted' and 'deleted', within the trigger.

 

SQL Server 2000 introduces INSTEAD OF triggers as well as the default "after" trigger. This trigger will be executed instead of the triggering statement, which makes it a very flexible alternative.

 

SQL Server triggers only fire once per query, so they are set triggers rather than row triggers.

 

SQL Server does not support SELECT triggers (trigger fire only on Insert, Update & Delete statements but not on Select statements).

 

 

No comments: