SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
Register Now and get your question answered!
Save Password
Forgot your Password?

 All Forums
 Site Related Forums
 Article Discussion
 Article: An Introduction to Triggers -- Part II
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Ask SQLTeam Question

0 Posts

Posted - 11/04/2001 :  17:31:24  Show Profile  Visit AskSQLTeam's Homepage  Reply with Quote
A few months ago I wrote an article for SQLTeam called An Introduction to Triggers -- Part I. The article covered trigger fundamentals--the most important being the way the inserted and deleted virtual tables work. I also showed an example of how to use an INSERT trigger to log activity on a web site.

In this article I want to show how to use a UPDATE and DELETE trigger and introduce INSTEAD OF triggers. If you are not familiar with the inserted and deleted tables please read this article before continuing.

Article Link.

Starting Member

1 Posts

Posted - 04/16/2010 :  13:36:31  Show Profile  Reply with Quote
Nice discussion...only quibble I have is in the NOT EXISTS query in the UPDATE trigger - is this really necessary? Since you have to examine the entire table anyway to determine NOT EXISTS, why not just do the COUNT(*)? Then determine by the value whether any action is required - if >0, do the message; otherwise do nothing.

I'd rather have a bottle in front of me than have to have a frontal lobotomy...

Edited by - TheMadProfessor on 04/16/2010 13:39:41
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.16 seconds. Powered By: Snitz Forums 2000