I made a trigger to log data whenever any CRUD operation with my tables happen. For example:
ALTER TRIGGER [Data_Created]
ON [Project_MyTable1]
AFTER INSERT
AS
INSERT INTO [Project_Logs] (Operation, LogData)
SELECT 'INSERT', ID
FROM INSERTED
It works just fine, but there is plenty of columns in my table which I'd like to see in my log data column. I'm struggling to find any way to extract all row data and convert it to nvarchar
or xml
(? maybe) except by concatenation.
Already tried a lot of things like:
Convert(nvarchar, (Select * FROM INSERTED))