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.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
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)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Create trigger syntax

A
CREATE TRIGGER triggername ON 
fullyqualifiedtblname 
FOR INSERT, UPDATE AS
BEGIN
    UPDATE
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

3 types of triggers

A

DDL - CREATE, ALTER, DROP
DML - INSERT, UPDATE, DELETE
Logon

How well did you know this?
1
Not at all
2
3
4
5
Perfectly