Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Hai,We used the below DDL Trigger during the table alter and we are able to get the T-SQL command/ statement from eventdata().ALTER TRIGGER trPreventTblChangeON DATABASEFOR ALTER_TABLEASDECLARE @Data XMLSET @Data = EventData()INSERT EvtLog (PostTime, LoginName, EventType, TSQLCommand,Data)VALUES(GETDATE(),CONVERT(NVARCHAR(100), CURRENT_USER),@Data.value('(/EVENT_INSTANCE/EventType)[1]', 'nvarchar(100)'),@Data.value('(/EVENT_INSTANCE/TSQLCommand)[1]', 'nvarchar(2000)'),CONVERT(NVARCHAR(4000),@Data) ) ;GOIs there any method to get the T-SQL command/ statement using DML triggers?.Ie. While we insert a record using INSERT Statement, is there any possible way to get the T-SQL Statement using DML trigger for AFTER INSERTThanks in advanceRegards,K.A.Maheshkumar