I would like to be able to identify the source of the query from within MSSQL using sp_whoisactive
. Originally I tried adding a comment to the code before the query. For whatever reason sp_whoisactive
sees that once & then removes the comment.
/* Some message here */
SELECT *
FROM [MYDB].[dbo].[FUNCTION]( DEFAULT, DEFAULT )
If I embed the comment as a WHERE
clause, mssql won't remove it. Also if I make it some arbitrary text that does not match some other arbitrary text with no reference to a table or column, I imagine there won't be any performance issues. IE
SELECT *
FROM [MYDB].[dbo].[FUNCTION]( DEFAULT, DEFAULT )
WHERE 'custom message' != 'Some message here'
What do you think? Will this cause a performance issue down the line?