How To Covert T-SQL Logic to Regular Expressions Logic

Monitor, diagnose and receive alerts to problems across your SQL Servers.

How To Covert T-SQL Logic to Regular Expressions Logic

Postby EdCarden » Wed Sep 25, 2013 5:59 pm

How To Filter the LRQ (Long Running Query) ALert using Regular Expressions

I don't know if its the way I'm asking this or if its just that the search critieria is too simple for Regular Expressions to work with but no RegEx forum I've searched is correctly answering my question. Perhaps its because some of the text such as the parenthesis are an issue because they are escape characters in the RegEx world?

I want to add a Regular Expression to the LRQ Alert (The long running query alert) that will filter out any LRQ's that contain the text below:

"WAITFOR (Receive convert(xml,message_body) from Queue"

The quotes are only for emphasis here and are not part of the text I'm trying to filter on. This text may be at the start of the SQL command/process and or it may have 0 to many characters after it and so the RegEx must filter out any querys that contain this text.

If I were to write a T-SQL query that would do this it would look like this:

SET @LRQALert = 'WAITFOR (Receive convert(xml,message_body) from Queue'

SELECT Case WHEN @LRQAlert LIKE'%WAITFOR (Receive convert(xml,message_body) from Queue%'

The above would return the value 'MATCH'.

If @LRQALewrt where set to "WAITFOR ME DOWN BY THE DOCKS" then the return would be "NO MATCH". Hopefully that will help some with this RegEx question.

Posts: 99
Joined: Tue Nov 25, 2008 5:26 pm

Return to SQL Monitor Previous Versions

Who is online

Users browsing this forum: No registered users and 0 guests