SQL SERVER default tracking app 3--
Detection of
DDL operations for tables
DDL operations that occur on the SQL Server database, can you tell who did it?
Yes. The SQL Server default trace has object modification events.
This script lists all the object modification events. Add time and database name restrictions to the query criteria.
Select E.name as Eventclass,t.loginname,t.spid,t.starttime,t.textdata,t.objectid,t.objectname,t.databasename, T.hostname,t.ntusername,t.ntdomainname,t.clientprocessid,t.applicationname,t.errorfrom sys.fn_trace_gettable ( CONVERT (VARCHAR), (SELECT TOP 1f.[ Value]from Sys.fn_trace_getinfo (NULL) f WHERE f.property = 2), DEFAULT) Tinner join sys.trace_events e on t.eventclass = E.trace_event_idwhere eventclass=164
650) this.width=650; "title=" image "style=" border-top:0px;border-right:0px;border-bottom:0px;border-left:0px; "alt = "image" src= "http://s3.51cto.com/wyfs02/M01/53/EB/wKiom1Rz8L_SzO_0AADdQmAzZsM878.jpg" height= "border=" 0 "/ >
This article is from the "Dripping Stone Wear" blog, please be sure to keep this source http://ultrasql.blog.51cto.com/9591438/1582296
SQL Server Default Trace Application 3--Detect DDL operations on tables