Friday, October 18, 2013

SQL Server Programmable objects:Triggers Trips,Trick and Traps:


Questions:


1.       Triggers are fired for which data manipulation events?

2.       What are the names of the two virtual tables that SQL Server maintains to be used with triggers?

3.       What are the different types of triggers?

4.       If an After trigger and a constraint are defined on table, which fires first:  the trigger or the constraint?

5.       Which triggers types are new to the game (since Sql Server 2000)?

6.       Which execute quicker: triggers or constraints?

7.       What keyword cancels a pending transaction within a trigger?

8.       What function will determine which column have been modified in a trigger?

9.       After records have been deleted , which virtual table would they be stored in  by SQL Server?

10.   What global variable provides the number of records most recently affected by a command?

Answers:


1.       DML events: INSERT, UPDATE AND DELETE

2.       INSERTED DELETED

3.       AFTER AND INSTEAD OF

4.       CONSTRAINTS

5.       INSTEAD OF

6.       CONSTRAINTS because they usually a LESS complex than TRIGGERS are

7.       ROLLBACK

8.       UPDATED()

9.       DELETED

10.   @@ROWCOUNT

No comments: