在 SQL Server 2008 中,我有一个 DDL 触发器,它正在获取使用以下触发器创建的表的表名:
CREATE TRIGGER [tr_getName] ON DATABASE FOR CREATE_TABLE
AS
DECLARE @xmlEventData XML
DECLARE @TableName varchar(128)
-- Capture the event data that is created
SET @xmlEventData = eventdata()
IF OBJECT_ID('dbo.tNames', 'U') IS NOT NULL
BEGIN
DeAllocate tNames
END
DECLARE tNames CURSOR Read_Only
FOR SELECT CONVERT(VARCHAR(128), @xmlEventData.query('data(/EVENT_INSTANCE/ObjectName)'))
OPEN tNames
FETCH Next FROM tNames
INTO @TableName
...
...
但是,在 SQL Azure 中不再支持 eventdata()。有没有办法在 SQL Azure 中完成等效操作?谢谢