when using a trigger in SQL SERVER 2005 the eventdata() always return a empty value.
only the date inserted in the Audit table, other fields are NULL valus
pls help me
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[TrigDip]
ON [dbo].[Dip]
AFTER INSERT,DELETE,UPDATE
AS
BEGIN
DECLARE @ed XML
SET @ed = EVENTDATA()
DECLARE @db varchar(1000)
set @db =EVENTDATA().value('(/EVENT_INSTANCE/DatabaseName)[1]', 'varchar(256)')
PRINT 'CREATE TABLE Issued.'
INSERT INTO Audit (PostTime, DatabaseName, Event, ObjectName, TSQL, Login)
VALUES
(
GetDate(),
@db,
EVENTDATA().value('(/EVENT_INSTANCE/EventType)[1]', 'nvarchar(100)'),
EVENTDATA().value('(/EVENT_INSTANCE/ObjectName)[1]', 'varchar(256)'),
EVENTDATA().value('(/EVENT_INSTANCE/TSQLCommand)[1]', 'nvarchar(2000)'),
CONVERT(nvarchar(100), CURRENT_USER)
)
END