Re: Perfact matching query?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



On Thu, 3 Nov 2005 09:54:41 -0500, Rogers wrote:

>I want to search the value by specific match but I couldn't... can any one
>let me know..
>
>
>select object_name(id) from syscomments where text like '%PresetVal%'
>
>When I run the above query it gave me 100 stored procedure but when I go one
>of them then I see the text contains PresetValues but I only want to get all
>the stored procedure which specific match by PresetVal not PresetValues....
>any idea ?
>
>Thanks
>

Hi Rogers,

To search for "PresetVal" but not "PresetValu" (and therefor not
"PresetValues" either), use

SELECT object_name(id)
FROM syscomments
WHERE text LIKE '%PresetVal[^u]%'
OR text LIKE '%PresetVal'

The first finds PresetVal followed by any character other than u; the
second finds PresetVal at the end of the text.

Best, Hugo
--

(Remove _NO_ and _SPAM_ to get my e-mail address)
.