Triggers Flashcards
0
Q
Differences between triggers and stored procedures
A
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.
1
Q
Can be defined on these objects
A
Can be applied to:
Tables, dbases, servers (logon)
Table (DML)
View (DML, instead of trigger)
Database (DDL)
Server (DDL)
2
Q
Create trigger syntax
A
CREATE TRIGGER triggername ON fullyqualifiedtblname FOR INSERT, UPDATE AS BEGIN UPDATE
3
Q
3 types of triggers
A
DDL - CREATE, ALTER, DROP
DML - INSERT, UPDATE, DELETE
Logon