Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

DDL trigger not capturing previous schema for ALTER SCHEMA TRANSFER

$
0
0

Hi,

I have a DDL trigger which captures ALTER SCHEMA TRANSFER queries. The EVENTDATA() shows the following:

<EVENT_INSTANCE>
  <EventType>ALTER_SCHEMA</EventType>
  <PostTime>2013-11-13T11:54:00.103</PostTime>
  <SPID>123</SPID>
  <ServerName>Servername</ServerName>
  <LoginName>Andrei</LoginName>
  <UserName>dbo</UserName>
  <DatabaseName>DBName</DatabaseName>
  <SchemaName>dbo</SchemaName>
  <ObjectName>Andrei_test</ObjectName>
  <ObjectType>TABLE</ObjectType>
  <TSQLCommand>
    <SetOptions ANSI_NULLS="ON" ANSI_NULL_DEFAULT="ON" ANSI_PADDING="ON" QUOTED_IDENTIFIER="ON" ENCRYPTED="FALSE" />
   <CommandText>ALTER SCHEMA dbo TRANSFER new.Andrei_test</CommandText>
  </TSQLCommand>
</EVENT_INSTANCE>

The problem is I need the previous schema of the table as well. I hope I won't be forced to parse the CommandText.

When renaming the table I have both the old as well as the new name.

Thanks,

Andrei


Viewing all articles
Browse latest Browse all 23857

Trending Articles