<& - • & o © |
Q http: //msdn2. microsoft. com/en-us/library/ms 186406. a$px |
© Idź |
[GL |
_ B 1 |
X | ||
W Wyzwalacz - Wikipedia, wolna encyklopedia |
^ Designing DDL Triggers |
W Database trigger - Wikipedia, the free ency... W Stored procedurę - Wikipedia, the free enc... |
£2 |
Microsoft.com Home | Site Map
United States
Search:
A
MSDN Home Developer Centers Library
OCI V Cl
] SQL Server 2005 Documentation □ SQL Server 2005 Books Online
□ Getting Started With SQL Server
□ What's New in SQL Server 2005
□ Installing SQL Server
□ SQL Server Overview
□ SQL Server Database Engine
□ Database Engine Architect Inf>
□ Database Engine Developer Ir
□ Database Engine Adrninistrato
□ Database Engine Information
□ Database Engine Concepts
□ Building Database Projects
□ Designing and Creating Datab
□ Databases (Database Engir
□ Federated Database Servei
□ Tables
□ Indexes :
□ Partitioned Tables and Inde
□ Views (Database Engine)
□ Stored Procedures (Databa
□ DML Triggers
□ DDL Triggers
□ Understanding DDLTrigi
Designing DDL Triggers
□ DDL Events for Use V-
□ Event Groups for Use
□ Using the EVEŃTDATł
□ Implementing DDLTrigę
□ Getting Information Abo
□ Event Notifications (Databa
□ User-defined Functions (Da
□ Assernblies
□ Synonyrns (Database Engir □ Accessing and Changing Datal v
< I >
Downloads How To Buy Subscribers MSDN Worldwide
In the following exarnple, DDLtrigger safety will fire whenever a DROP TABLE or ALTER TABLE event occurs in the database:
In the next exarnple, a DDLtrigger prints a rnessage if any CREATE LOGIN, ALTER LOGIN, or DROP LOGIN event occurs on the current server instance. It uses the EVENTDATA function to retrieve the text of the corresponding Transact-SQL staternent. For rnore information about how to use EVENTDATA with DDL Triggers, see Using the EVENTDATA Function.
The lists that map the Transact-SQL staternents to the scopes that can be specified forthern are available through the links provided in the section, Selecting a Particular DDL Staternent to Fire a DDLTrigger.
Database-scoped DDL triggers are stored as objects in the database in which they are created. DDL triggers can be created in the master database and behave just like those created in user-designed databases. Information about DDL triggers can be obtained in the sys.triggers catalog view frorn within the database context in which they are created, or by specifying the database narne as an identifier (for exarnple, master. sys. tri ggers).
Server-scoped DDL triggers are stored as objects in the master database. However, information about server-scoped DDL triggers can be obtained frorn the sys.server_triggers catalog view in any database context.
For rnore information about retrieving rnetadata for DDL triggers, see Getting Information About DDL Triggers.