Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with.
    
        
            
                
                    
                        
                            
                                | Author | 
                                
                                 Topic  | 
                             
                            
                                    | 
                                         AskSQLTeam 
                                        Ask SQLTeam Question 
                                         
                                        
                                        0 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2001-11-04 : 17:31:24
                                            
  | 
                                             
                                            
                                            | 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.  | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     TheMadProfessor 
                                    Starting Member 
                                     
                                    
                                    1 Post  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2010-04-16 : 13:36:31
                                          
  | 
                                         
                                        
                                          | 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...  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |