SQL-Server Triggers  «Prev 

How do I modify Triggers in SQL-Server

To modify a trigger in SQL Server, you can use the following steps:
  1. Connect to the database where the trigger you want to modify is located.
  2. Use the following command to change the trigger definition:
    ALTER TRIGGER trigger_name
    ON table_name
    AFTER/INSTEAD OF event
    AS
    BEGIN
        -- trigger definition
    END
    
  3. Replace trigger_name with the name of the trigger you want to modify.
  4. Replace table_name with the name of the table the trigger is associated with.
  5. Specify the AFTER or INSTEAD OF clause, depending on when you want the trigger to be executed.
  6. Replace the -- trigger definition with the new trigger definition you want to use.
  7. Execute the command.

For example, if you want to modify a trigger named update_product_price_trigger that is associated with the products table and is executed after update events, you can use the following command:

ALTER TRIGGER update_product_price_trigger
ON products
AFTER UPDATE
AS
BEGIN
    -- new trigger definition
END

SQL-Server 2019

Modify Triggers

1) Tests whether the data being inserted violates the business rule.

2) Removes rows from the Employee table

3) Returns an error back to the calling program