I created an Extended Event Session using a script with a Where clause in order to filter commands which refers to a table whose name is MySchema.MyTable:
WHERE ([sqlserver].[like_i_sql_unicode_string]([sqlserver].[sql_text],N'%MySchema.MyTbl%'))
The problem is that the table can appear in one of the 4 following ways:
MySchema.MyTable
[MySchema].MyTable
MySchema.[MyTable]
[MySchema].[MyTable]
I can create a long Where clause with al those options and the "Or" operator between them (a to find a good solution to the ambiguity of the characters ],[), but it is not very elegant. I wish I could use Replace operator in order to remove those characters (],[) but I don't know how.. Any suggestions?