Red Gate forums :: View topic - How To Covert T-SQL Logic to Regular Expressions Logic
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Monitor 3
SQL Monitor 3 forum

How To Covert T-SQL Logic to Regular Expressions Logic

Search in SQL Monitor 3 forum
Post new topic   Reply to topic
Jump to:  
Author Message
EdCarden



Joined: 25 Nov 2008
Posts: 90

PostPosted: Wed Sep 25, 2013 6:59 pm    Post subject: How To Covert T-SQL Logic to Regular Expressions Logic Reply with quote

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:

DECLARE @LRQAlert VARCHAR(256)
SET @LRQALert = 'WAITFOR (Receive convert(xml,message_body) from Queue'

SELECT Case WHEN @LRQAlert LIKE'%WAITFOR (Receive convert(xml,message_body) from Queue%'
THEN 'MATCH'
ELSE 'NO MATCH'
END

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.


Thanks
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group