codecontractor
Programmer
I'm looking for a way to streamline the following stored procedure query using regular expressions:
---------------------------------------
SELECT *
FROM TitleTable
WHERE
Title like @searchString OR
Title like @searchString + 's' OR
Title like @searchString + 'es' OR
Title like @searchString + 'ing' OR
Title like @searchString + 'd' OR
Title like @searchString + 'ed'
---------------------------------------
I was hoping there was something along the lines of:
---------------------------------------
Title like @searchString OR
Title like @searchString + '(s)|(es)|(ing)|(d)|(ed)'
---------------------------------------
(Obviously this doesn't work.)
I have done things like this before with regular expressions in other environments, but I can't find documentation anywhere on how I can do this in T-SQL.
Thanks,
-Ben
---------------------------------------
SELECT *
FROM TitleTable
WHERE
Title like @searchString OR
Title like @searchString + 's' OR
Title like @searchString + 'es' OR
Title like @searchString + 'ing' OR
Title like @searchString + 'd' OR
Title like @searchString + 'ed'
---------------------------------------
I was hoping there was something along the lines of:
---------------------------------------
Title like @searchString OR
Title like @searchString + '(s)|(es)|(ing)|(d)|(ed)'
---------------------------------------
(Obviously this doesn't work.)
I have done things like this before with regular expressions in other environments, but I can't find documentation anywhere on how I can do this in T-SQL.
Thanks,
-Ben