• tgarth (12/14/2007)


    Why wouldn't you have used a foreign key with cascaded deletes instead?

    I generally do. Triggers are only an exception to the rule. There are certain times when a trigger is necessary due to the application and/or the data model.

    Examples:

    - SQL Server 2000 doesn't support ON DELETE SET NULL

    - Often times in a hierarchical structure (i.e., parent -> child relationships) you'll get burnt as the FK constraint is checked at each row deletion. SQL Server doesn't support "deferrable" (check at the end of the transaction) constraint checking like Oracle does.


    [font="Arial Narrow"](PHB) I think we should build an SQL database. (Dilbert) What color do you want that database? (PHB) I think mauve has the most RAM.[/font]