在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中实现等效? 谢谢
答案 0 :(得分:-1)