How to filter a table name in Extended Events?

荒凉一梦 提交于 2019-12-25 04:45:29

问题


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?


回答1:


After some investigation I think a good solution would be to filter by the object_id instead of by manipulating the SQL string in order to find the object name



来源:https://stackoverflow.com/questions/27835678/how-to-filter-a-table-name-in-extended-events

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!