I use the OUTPUT clause in my UPDATE and INSERT for the protocol of changes made to the database by my script. For logging, I would like to smooth the output of the OUTPUT clause into a single plaintext value that I could insert into one cell of my debug audit table.
The only solution I decided with was to manually concatenate all the output fields, but since some of them may be NULL , I also have to check this before concatenation, and the final script looks ugly.
Is there an easier and more elegant way to smooth out the output into plain text, similar to how it is done with the XML FOR XML clause?
source share