Chapter 9 -- Implementing Triggers

3 4

Chapter 9

Implementing Triggers

About This Chapter

Triggers are a special class of stored procedure defined to execute automatically in place of or after data modification. The three commands that fire a trigger are UPDATE, INSERT, and DELETE. Use triggers to extend data integrity and to implement complex business logic. In this chapter, you will learn when it is appropriate to implement triggers and when basic constraints will suffice. Create triggers by using Transact-SQL language or SQL Enterprise Manager. Management tasks include altering, renaming, viewing, dropping, and disabling triggers. Triggers use two pseudo tables, Inserted and Deleted, to detect data modifications. Programming triggers requires a thorough understanding of these pseudo tables and the Transact-SQL language. In this chapter, you will learn how to program triggers and how to use a number of system commands and functions commonly used in trigger programming. Tasks commonly completed by implementing triggers include maintaining running totals and other computed values, creating an audit record of data modifications, invoking external actions, and implementing complex data integrity.

Before You Begin

To complete the lessons in this chapter, you must have:

  • SQL Server 2000 Enterprise Edition installed on a Windows 2000 Server computer.
  • The ability to log on to the Windows 2000 Server computer and to SQL Server as the Windows 2000 Administrator.
  • Completed the exercises in Chapter 3, "Designing a SQL Server Database," Chapter 4, "Implementing SQL Server Databases and Tables," Chapter 5, "Implementing Data Integrity," and in Chapter 7, "Managing and Manipulating Data."


Microsoft Press Staff - MCSE. Microsoft SQL Server 2000 Database Design and Implementation Training Kit
MCSE Training Kit (Exam 70-229): Microsoft SQL Server(TM) 2000 Database Design and Implementation (Pro Certification)
ISBN: 073561248X
EAN: 2147483647
Year: 2001
Pages: 97

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net