July 20, 2012 at 2:02 pm
Hi,
I have a question regarding the use of EVENTDATA().
If I rename a column X in table Table1, I am seeing the name of the rename column in /EVENT_INSTANCE/ObjectName. How I can find the name of the table (or parent object).
Thanks,
July 20, 2012 at 2:11 pm
looks like you are looking at the right tag, i think. maybe it's int he AlterTableActionList?
http://schemas.microsoft.com/sqlserver/2006/11/eventdata/
inthe ALTER_TABLE events,
here's the XML tags:
-<xs:complexType name="EVENT_INSTANCE_ALTER_TABLE"> -<xs:sequence>
<!-- Basic Envelope -->
<xs:element type="SSWNAMEType" name="EventType"/>
<xs:element type="xs:string" name="PostTime"/>
<xs:element type="xs:int" name="SPID"/>
<!-- Server Scoped DDL -->
<xs:element type="PathType" name="ServerName"/>
<xs:element type="SSWNAMEType" name="LoginName"/>
<!-- DB Scoped DDL -->
<xs:element type="SSWNAMEType" name="UserName"/>
<!-- Main Body -->
<xs:element type="SSWNAMEType" name="DatabaseName"/>
<xs:element type="SSWNAMEType" name="SchemaName"/>
<xs:element type="SSWNAMEType" name="ObjectName"/>
<xs:element type="SSWNAMEType" name="ObjectType"/>
<xs:element type="EventTag_Parameters" name="Parameters" minOccurs="0"/>
<xs:element type="AlterTableActionListType" name="AlterTableActionList" minOccurs="0"/>
<xs:element type="EventTag_TSQLCommand" name="TSQLCommand"/>
</xs:sequence>
Lowell
July 20, 2012 at 2:21 pm
looking again, i think there is a TargetObjectName in the RENAME schema.
-<xs:complexType name="EVENT_INSTANCE_RENAME"> -<xs:sequence>
<!-- Basic Envelope -->
<xs:element type="SSWNAMEType" name="EventType"/>
<xs:element type="xs:string" name="PostTime"/>
<xs:element type="xs:int" name="SPID"/>
<!-- Server Scoped DDL -->
<xs:element type="PathType" name="ServerName"/>
<xs:element type="SSWNAMEType" name="LoginName"/>
<!-- DB Scoped DDL -->
<xs:element type="SSWNAMEType" name="UserName"/>
<!-- Main Body -->
<xs:element type="SSWNAMEType" name="DatabaseName"/>
<xs:element type="SSWNAMEType" name="SchemaName"/>
<xs:element type="SSWNAMEType" name="ObjectName"/>
<xs:element type="SSWNAMEType" name="ObjectType"/>
<xs:element type="SSWNAMEType" name="TargetObjectName"/>
<xs:element type="SSWNAMEType" name="TargetObjectType"/>
<xs:element type="SSWNAMEType" name="NewObjectName"/>
<xs:element type="EventTag_Parameters" name="Parameters" minOccurs="0"/>
<xs:element type="EventTag_TSQLCommand" name="TSQLCommand"/>
</xs:sequence>
</xs:complexType>
Lowell
July 20, 2012 at 2:44 pm
Oh, awesome !
Thanks
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply