Differences between triggers and stored procedures
Triggers are fired by an event like a tbl insert not called
They have the deleted (old row copy) and the inserted (new row copy) tbls available.
Triggers does not have I/o parameter option.
Triggers never return tbl like results.
Note: a downside to triggers when deleted its not easily detected compared to stores proc.
Can be defined on these objects
Can be applied to:
Tables, dbases, servers (logon)
Table (DML)
View (DML, instead of trigger)
Database (DDL)
Server (DDL)
Create trigger syntax
CREATE TRIGGER triggername ON
fullyqualifiedtblname
FOR INSERT, UPDATE AS
BEGIN
UPDATE3 types of triggers
DDL - CREATE, ALTER, DROP
DML - INSERT, UPDATE, DELETE
Logon