Skip to content

Instantly share code, notes, and snippets.

@alfonsusac
Last active November 13, 2020 14:46
Show Gist options
  • Save alfonsusac/5b9c89caaf7892d7f09b4c25b5010c59 to your computer and use it in GitHub Desktop.
Save alfonsusac/5b9c89caaf7892d7f09b4c25b5010c59 to your computer and use it in GitHub Desktop.
CREATE TRIGGER Trigger_name -> declraing a trigger with Trigger_name
(AFTER) -> when the trigger will be executed
[ INSERT | UPDATE | DELETE ] -> The operation that can be performed
ON [Table_Name] -> which table to do the operation on
AS
[ Trigger_body ] -> the queries to be executed by trigger
CREATE TRIGGER trigger_name ON ms_customers
AFTER INSERT,UPDATE,DELETE
AS BEGIN
SELECT * FROM DELETED
SELECT * FROM INSERTED
END
Creates two temporary table called INSERTED and DELETED
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment