December 2001
Intermediate to advanced
800 pages
17h 55m
English
As its name suggests, an INSTEAD OF trigger executes instead of a DML operation. This is in contrast to AFTER triggers, which run after an operation has completed, but before the transaction has been committed. INSTEAD OF triggers are handy for updates against views and tables that would otherwise be too complex to handle with anything but a stored procedure.
Here's a simple INSTEAD OF trigger example (Listing 8-8):
USE tempdb GO CREATE TABLE AussieArtists (ArtistId int Identity, LastName varchar(30), FirstName varchar(30) ) GO INSERT AussieArtists VALUES ('Gibb', 'Barry') INSERT AussieArtists VALUES ('Gibb', 'Maurice') INSERT AussieArtists VALUES ('Gibb', 'Robin') INSERT ... |
Read now
Unlock full access