I'm using triggers to audit table changes. Right now I capture the individual column changes in the following:
DECLARE @statement VARCHAR(MAX)
SELECT @statement =
'Col1: ' + CAST(ISNULL(Col1, '') AS VARCHAR) + ', Col2: ' + CAST(ISNULL(Col2, '') AS VARCHAR) + ', Col3: ' + CAST(ISNULL(Col3, '') AS VARCHAR)
FROM INSERTED;
The problem is, I need to tweak the column names for every table/trigger that I want to audit against. Is there a way I can build @statement, independent of the table using a more generic approach?
cheers David