March 17, 2010 at 7:53 pm
Hi guys is there any way to do a pattern search for any single character... or no character at all without using %?
I have a trace running on a server and the search queries I need to parse are like 20 pages long... so you can imagine how many occurances of spaces, dashes and quotes I have in there.
I need to search for an order number with this pattern (notice the quote at the end).
VC[nothing or W]<DASH>[0-9][0-9][0-9][0-9][0-9][0-9]<DASH>[0-9][0-9]'
Since I didn't want to do an or condition I instead went with REPLACE (@string, 'VCW', 'VC') and it solved it but I'm wondering if there's a better way.
My other challenge is that if I use a % for the nothing or w part I get a false positive further in the string.
March 17, 2010 at 11:50 pm
Can't think of a direct T-SQL method, given the conditions, aside from to use regular expressions via a CLR routine.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply