<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Audit databases &#8211; Using DDL triggers</title>
	<atom:link href="http://sqlknowledge.com/2010/06/audit-databases-using-ddl-triggers/feed/" rel="self" type="application/rss+xml" />
	<link>http://sqlknowledge.com/2010/06/audit-databases-using-ddl-triggers/</link>
	<description>Life is SQLized..</description>
	<lastBuildDate>Tue, 10 Jan 2012 14:53:41 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<item>
		<title>By: vl</title>
		<link>http://sqlknowledge.com/2010/06/audit-databases-using-ddl-triggers/comment-page-1/#comment-58</link>
		<dc:creator>vl</dc:creator>
		<pubDate>Wed, 30 Nov 2011 14:48:30 +0000</pubDate>
		<guid isPermaLink="false">http://sqlknowledge.com/2010/06/audit-databases-using-ddl-triggers/#comment-58</guid>
		<description>what about data changes?
can we have something like this for data changes in DB?</description>
		<content:encoded><![CDATA[<p>what about data changes?<br />
can we have something like this for data changes in DB?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Deepak</title>
		<link>http://sqlknowledge.com/2010/06/audit-databases-using-ddl-triggers/comment-page-1/#comment-13</link>
		<dc:creator>Deepak</dc:creator>
		<pubDate>Tue, 30 Nov 2010 17:58:39 +0000</pubDate>
		<guid isPermaLink="false">http://sqlknowledge.com/2010/06/audit-databases-using-ddl-triggers/#comment-13</guid>
		<description>Apologies for delayed response.. I missed your post.

In my opinion; Using tables to store DDL changes is efficient way instead relying on trace files only. The reason I see are;

- Trace file(s) may get deleted over a period of time.
- Trace files will not provide you actual T-SQL 
- With Table; its very easy to search from years old data to find out multiple version of an SP or changes in it. However, trace files are recreated with every SQL restart makes it hard to club all files.
- With Trace Tables; You can add multiple alerts or create daily/weekly or monthly report for DB schema changes easily for further analysis.



let me know what you think...</description>
		<content:encoded><![CDATA[<p>Apologies for delayed response.. I missed your post.</p>
<p>In my opinion; Using tables to store DDL changes is efficient way instead relying on trace files only. The reason I see are;</p>
<p>- Trace file(s) may get deleted over a period of time.<br />
- Trace files will not provide you actual T-SQL<br />
- With Table; its very easy to search from years old data to find out multiple version of an SP or changes in it. However, trace files are recreated with every SQL restart makes it hard to club all files.<br />
- With Trace Tables; You can add multiple alerts or create daily/weekly or monthly report for DB schema changes easily for further analysis.</p>
<p>let me know what you think&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill Galashan</title>
		<link>http://sqlknowledge.com/2010/06/audit-databases-using-ddl-triggers/comment-page-1/#comment-11</link>
		<dc:creator>Bill Galashan</dc:creator>
		<pubDate>Mon, 14 Jun 2010 16:03:14 +0000</pubDate>
		<guid isPermaLink="false">http://sqlknowledge.com/2010/06/audit-databases-using-ddl-triggers/#comment-11</guid>
		<description>why re-invent the wheel and put additional processing onto a server to obtain information that is already directly available? 

Schema changes are recorded in the default trace and there is a standard report available from SSMS to determine any DDL changes per database.

It is also simple to extract the details from the  default trace

declare @logfilename sysname

select @logfilename = path from sys.traces where id = 1 

SELECT Eventclass, 
	case	
		when EventClass = 164 then &#039;Alter&#039;
		when EventClass = 46 then &#039;Create&#039;
		else &#039;Drop&#039;
	end as [DDL Action], LoginName,SPID,StartTime,ObjectID,ObjectName,DatabaseName 
FROM fn_trace_gettable(@logfilename, default) 
where eventclass in (164,46,47)
and DatabaseID &gt; 4 
and ObjectName is not null  

There can also be a problem with a subscriber in a replication scenario as a DDL trigger on the subscriber will cause a snapshot to fail. This is something Microsoft are aware of but as yet have not come up with a solution</description>
		<content:encoded><![CDATA[<p>why re-invent the wheel and put additional processing onto a server to obtain information that is already directly available? </p>
<p>Schema changes are recorded in the default trace and there is a standard report available from SSMS to determine any DDL changes per database.</p>
<p>It is also simple to extract the details from the  default trace</p>
<p>declare @logfilename sysname</p>
<p>select @logfilename = path from sys.traces where id = 1 </p>
<p>SELECT Eventclass,<br />
	case<br />
		when EventClass = 164 then &#8216;Alter&#8217;<br />
		when EventClass = 46 then &#8216;Create&#8217;<br />
		else &#8216;Drop&#8217;<br />
	end as [DDL Action], LoginName,SPID,StartTime,ObjectID,ObjectName,DatabaseName<br />
FROM fn_trace_gettable(@logfilename, default)<br />
where eventclass in (164,46,47)<br />
and DatabaseID &gt; 4<br />
and ObjectName is not null  </p>
<p>There can also be a problem with a subscriber in a replication scenario as a DDL trigger on the subscriber will cause a snapshot to fail. This is something Microsoft are aware of but as yet have not come up with a solution</p>
]]></content:encoded>
	</item>
</channel>
</rss>

