I would like to take a field and replace all characters that are not between a-z and A-Z with “”.
Is this possible, and if so, how?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You could create a
CLRstored procedure to do the regular expression replacement. Here’s an article on that topic:http://weblogs.sqlteam.com/jeffs/archive/2007/04/27/SQL-2005-Regular-Expression-Replace.aspx
Then you could do something like this:
EDIT:
Since
CLRisn’t an option, check out this link, there is adbo.RegexReplacefunction there which is written in t-sql, not CLR. You could use that function in the following manner:First, you need to run this to enable Ole:
Then create the
dbo.RegexReplacefunction given at the link I provided.Then you can do this: