I'm trying to strip all punctuation out of a value in a MSSQl database so that I can compare it to a string that won't have any punctuation. For various reasons, I'm replacing the spaces as well with hyphens. Therefore, a given string of:
hello-there-everyone
should match a database value of
Hello There! Everyone!
Currently I've got
which takes care of the spaces/hyphens issue. Is there any way to strip out the punctuation without nesting lots of replace statements?
hello-there-everyone
should match a database value of
Hello There! Everyone!
Currently I've got
Code:
select * from table where REPLACE(field,' ','-') = @input