datetime century date into pad dynamic cursor money percent sp job isnumeric isdate over update
SQLUSA.com
SQL 2008 GRAND SLAM ON 49 CD
FREE TRIAL  CLICK HERE TO ORDER  SEARCH
SQL Server Training SQL 2005 Scripts SQL 2008 Articles
SQL JOBS News Format Developer
How not to use triggers?

Triggers are high maintenance database objects. They should be used as last resort only, for example, enterprise-wide business rule enforcement (applications cannot be changed for a particular business rule) by senior DBA-s and database developers. Triggers should not be used as fix-it-all database objects. For auditing purposes, the OUTPUT clause has been introduced with SQL Server 2005.

Hierarchy of implementing database solutions:

1. Database design

2. Constraints

3. Stored procedures

4. Triggers

Issues with Triggers

1. Triggers don't "complain" when dropped thus may cause database integrity violations and huge application malfunctions

2. Triggers are difficult to view in SQL Server 2008 Object Explorer; even bigger viewing problems in older versions

3. Triggers execute invisible thus causing database development productivity problems

4. Triggers can be disabled, again no "complaint" from trigger as opposed to strored procedure which would cause application to error out, which may break the applications

5. Trigger logic, firing sequence and testing are quite a challenge; for example programming for single vs. multiple rows update/insert/delete/merge statements

6. Triggers can be forgotten thus causing operational problems which is a real big issue in migration

7. Dangerous mix: triggers are the favorite of "newbies" to database programming to fix all the short-comings in design and development; instead of "fix" trigger solutions usually create new problems

8. Triggers run every time on insert/update/delete/merge statements which may cause performance problems especially on large operations

 

Related articles:

http://www.sqlusa.com/bestpractices2008/output/

Exploring SQL Server Triggers by John Papa

 

Order SQL 2008 GRAND SLAM Today!
SQLUSA.com Home Page
SQL Server Training at www.sqlusa.com.
Microsoft SQL Server 2012 Training Videos at www.sqlusa.com.
SQL Server 2008 Video Training at www.sqlusa.com.
SQL Server 2005 Training Videos at www.sqlusa.com.
Accounting
Administrative
Advertising
Arts
Architecture
Banking
Business Intelligence
Career Jobs
Celebrity
Computer
Consulting
Customer Service
Education
Engineering
Entertainment
Entry Level
Executive
Federal
Finance
Government
Hardware
Healthcare
Hospital
Human Resources
Information Technology
Insurance
Internet
Job Openings
Laboratory
Law Enforcement
Legal
Logistics
Manufacturing
Marketing
Medical
Military
Nursing
Pharmaceutical
Physician
Public Relations
Publishing
Real Estate
Restaurant
Retail
Sales
Social Media
Software
SQL Database
Telecomm
Therapist
Training
Transportation
Truck Driver
Travel
Web
Work from Home

FREE SS SQL / BI OLAP Short Videos on YOUTUBE.com

Microsoft Community Contributor 2011 Microsoft Community Contributor 2012

Search SQLUSA FREE SQL Server Articles & FREE T-SQL Scripts

JOIN US ON TWITTER

Copyright 2005-2012, SMI Corp. All Rights Reserved.

SQL Server 2012 is a program product of Microsoft Corporation.
SQL Server 2008 is a program product of Microsoft Corporation.
SQL Server 2005 is a program product of Microsoft Corporation.
SQL Server 2000 is a program product of Microsoft Corporation.