Skip to content

Instantly share code, notes, and snippets.

@max-mulawa
Created April 19, 2011 19:00
Show Gist options
  • Save max-mulawa/929277 to your computer and use it in GitHub Desktop.
Save max-mulawa/929277 to your computer and use it in GitHub Desktop.
DML Trigger Snippet 1
use master;
GO
CREATE DATABASE TriggerDatabase;
GO
use TriggerDatabase;
GO
CREATE TABLE dbo.Customers
(
CustomerName Varchar(10) NOT NULL
)
GO
CREATE TRIGGER dbo.Customers_AfterDelete
ON dbo.Customers
AFTER DELETE
AS
BEGIN
PRINT 'After Delete'
END
GO
DELETE FROM Customers
WHERE 1=0
GO
DROP TRIGGER dbo.Customers_AfterDelete
GO
--Results
--After Delete
--(0 row(s) affected)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment