Login | Register   
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Enterprise
Expertise: Intermediate
Nov 30, 2000

Using INSTEAD OF In Place of Triggers In SQL Server 2000


The new INSTEAD OF functionality is not exactly like a trigger, but similar. Unlike AFTER triggers, the INSTEAD OF trigger replaces the incoming transaction data modification statement with its own code segment. This can be demonstrated with the following example. We first define a simple table:
 
CREATE TABLE TestTBL
(
	id	INT NOT NULL IDENTITY,
	msg	INT NOT NULL 
);
GO;

Now we define an INSTEAD OF trigger.
 
CREATE TRIGGER trgIntercepted ON TestTBL INSTEAD OF INSERT
AS

DECLARE	@ret_msg	AS	VARCHAR(100);

SET @ret_msg = 
Andrew Holliday
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap