July 24, 2008 at 11:00 am
Hi All,
Please explain me what is DDL trigger and why it is necessary??
Thanks in advance..
Milu.:)
July 24, 2008 at 11:41 am
See http://www.simple-talk.com/sql/sql-server-2005/sql-server-2005-ddl-trigger-workbench/ for a good explanation and example of how to implement.
July 24, 2008 at 11:43 am
DDL triggers handle events when objects are modified in your database. Here is a quick excerpt from BOL:
DDL triggers, like regular triggers, fire stored procedures in response to an event. However, unlike DML triggers, they do not fire in response to UPDATE, INSERT, or DELETE statements on a table or view. Instead, they fire in response to a variety of Data Definition Language (DDL) statements. These statements are primarily statements that start with CREATE, ALTER, and DROP. DDL triggers can be used for administrative tasks such as auditing and regulating database operations...
Go to BOL and type in DDL trigger in your search and you will have plenty of information on what you can do with them
July 25, 2008 at 10:46 am
Thanks a Lot....
luv's
Milu..:)
July 27, 2008 at 12:40 am
DDL Trigger -> Its a new concept introduced in SQL Server 2005.
Its used to control and monitor the DDL statements executed in our database.
Consider the below example,
I have created a DDL trigger for drop statement. Now, if a user tried to drop my tables. It will be automatically throw an error message.
--------------------------------------------------------------------------------
CREATE TRIGGER DDLTriggertoSaveTable
ON DATABASE FOR DROP_TABLE AS
PRINT 'M No way to delete the tables in the Database?'
ROLLBACK
---------------------------------------------------------------------------------
Drop Table VenkatTestDLLTriggers
Thanks and Regards,
Venkatesan Prabu, 😛
My Blog:
http://venkattechnicalblog.blogspot.com/
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply