﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Discuss Content Posted by S. Srivathsani / Article Discussions / Article Discussions by Author  / Understanding DDL Triggers in SQL Server 2005 / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Mon, 20 May 2013 13:01:44 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Understanding DDL Triggers in SQL Server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic351580-365-1.aspx</link><description>hm, is good script but, because: DB_User, Event_Typeis null? is not LOGIN of user? por example: i create login:create login lucas with password = '123'i connect with lucasnow, i create table:create table tbl ( id int )DB_User: lucas ??</description><pubDate>Mon, 23 Feb 2009 06:14:01 GMT</pubDate><dc:creator>lucassouzace</dc:creator></item><item><title>RE: Understanding DDL Triggers in SQL Server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic351580-365-1.aspx</link><description>can Iplease haver the command for trigger and stored procedures and the standard format for querying tablesthank you</description><pubDate>Thu, 21 Aug 2008 10:42:59 GMT</pubDate><dc:creator>paul2g2</dc:creator></item><item><title>RE: Understanding DDL Triggers in SQL Server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic351580-365-1.aspx</link><description>&lt;P&gt;Thank you.  You just answered two questions for me at the same time:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;How to force everything to go through this method so that everything is tracked.&lt;/LI&gt;&lt;LI&gt;How to get around the "lock out" that I discribed.&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;You restrict the use of sp_rename.  This forces everybody else to use ALTER TABLE, ALTER COLUMN, etc. to make changes.  If your logon still has access to sp_rename, etc. this gives you a back door.&lt;/P&gt;</description><pubDate>Fri, 06 Jul 2007 08:02:00 GMT</pubDate><dc:creator>Charles Kincaid</dc:creator></item><item><title>RE: Understanding DDL Triggers in SQL Server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic351580-365-1.aspx</link><description>&lt;P&gt;As i already told , if you use the sp_rename stored procedures these triggers do nothing, nada.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Fri, 06 Jul 2007 00:36:00 GMT</pubDate><dc:creator>Jurgen H.</dc:creator></item><item><title>RE: Understanding DDL Triggers in SQL Server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic351580-365-1.aspx</link><description>Oracle has had this functionality for a loooong time. As a result, you might want to look at how Oracle databases use the DDL (and other) System level triggers. For myself, I have created a DDL trigger in Oracle's SYS schema to record all changes including what object changed when, and by whom. As well, I have LOGIN/LOGOFF triggers that can be used to track who  logged in, from where and if they changed any data (track COMMITs/rollbacks from Oracle's DMV)John Kanagaraj</description><pubDate>Thu, 05 Jul 2007 17:24:00 GMT</pubDate><dc:creator>John Kanagaraj</dc:creator></item><item><title>RE: Understanding DDL Triggers in SQL Server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic351580-365-1.aspx</link><description>I am confused with what you told in previous post.</description><pubDate>Thu, 05 Jul 2007 10:23:00 GMT</pubDate><dc:creator>Bhavin Patel-257492</dc:creator></item><item><title>RE: Understanding DDL Triggers in SQL Server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic351580-365-1.aspx</link><description>&lt;P&gt;I can see trouble brewing here.  Would it be possible to:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Create triggers that block all changes on tables, etc.&lt;/LI&gt;&lt;LI&gt;Create a trigger that blocks changes on all triggers?&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;How would one every get out of this?&lt;/P&gt;&lt;P&gt;Another reason to tighly control such things.  A ticked off admin could do this and then leave.  You might not find it for a long time.  I have production databases that have not had a DDL change in years.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;</description><pubDate>Thu, 05 Jul 2007 10:15:00 GMT</pubDate><dc:creator>Charles Kincaid</dc:creator></item><item><title>RE: Understanding DDL Triggers in SQL Server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic351580-365-1.aspx</link><description>where do I create trigger? in master database? it will fire where any new database is created,right?</description><pubDate>Thu, 05 Jul 2007 09:01:00 GMT</pubDate><dc:creator>Bhavin Patel-257492</dc:creator></item><item><title>RE: Understanding DDL Triggers in SQL Server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic351580-365-1.aspx</link><description>&lt;P&gt;Most of the code samples are untested and need fixing if you want to see them work.&lt;/P&gt;&lt;P&gt;Here's what I've settled on to cover most activities - created in all mission-critical databases:&lt;/P&gt;&lt;P&gt;CREATE TRIGGER Trig_DBEvents ON DATABASE FOR DDL_DATABASE_LEVEL_EVENTSAS    INSERT master.dbo.ddl_all_databases        (            DateTime,            LoginName,            DBName,            UserName,            EventType,            CommandText        )    SELECT  GETDATE(),            EVENTDATA().value('(/EVENT_INSTANCE/LoginName)[1]','nvarchar(50)'),            EVENTDATA().value('(/EVENT_INSTANCE/DatabaseName)[1]','nvarchar(50)'),            EVENTDATA().value('(/EVENT_INSTANCE/UserName)[1]','nvarchar(50)'),            EVENTDATA().value('(/EVENT_INSTANCE/EventType)[1]','nvarchar(50)'),            EVENTDATA().value('(/EVENT_INSTANCE/TSQLCommand/CommandText)[1]','nvarchar(1024)')GO&lt;/P&gt;</description><pubDate>Wed, 04 Jul 2007 02:27:00 GMT</pubDate><dc:creator>Cedric Cullingworth</dc:creator></item><item><title>RE: Understanding DDL Triggers in SQL Server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic351580-365-1.aspx</link><description>It's a pitty it does not cover renaming columns, tables...</description><pubDate>Wed, 04 Jul 2007 00:42:00 GMT</pubDate><dc:creator>Jurgen H.</dc:creator></item><item><title>Understanding DDL Triggers in SQL Server 2005</title><link>http://www.sqlservercentral.com/Forums/Topic351580-365-1.aspx</link><description>Comments posted here are about the content posted at &lt;A HREF="http://www.sqlservercentral.com/columnists/sSrivathsani/2927.asp"&gt;http://www.sqlservercentral.com/columnists/sSrivathsani/2927.asp&lt;/A&gt;</description><pubDate>Wed, 14 Mar 2007 13:19:00 GMT</pubDate><dc:creator>srivathsani-296624</dc:creator></item></channel></rss>