Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 REGEX or REPLACE
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

brendanb
Starting Member

United Kingdom
7 Posts

Posted - 11/11/2013 :  19:29:10  Show Profile  Reply with Quote
Hi,

I have for example a phone number field that has a multitude of characters I want to strip out so I can do a comparison on a query. Does SQL have any built in REGEX functions?

I know I could do REPLACE(X,' ', ''), but this seems like a bad way to have to handle various characters. Like for example I could have a Space, Pipe, or some other character

regards
Brendan

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 11/12/2013 :  01:46:06  Show Profile  Reply with Quote
you can write a CLR procedure for that. .NET has regexmatch function.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 11/12/2013 :  01:47:52  Show Profile  Reply with Quote
see
http://msdn.microsoft.com/en-us/magazine/cc163473.aspx

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000