Using regular expression in Ms Sql Server
I have a problem regarding sql query like below.
Table Name:Distributors
Colname:Phone varchar(20)
Data for Phone No:(965)-122-4526 or 965-122-4526.
I want to perform a select operation in Sql server(2008) using regular expression like below.
Select * from Distributors
Where
REPLACE(Phone,'regexp','') = <cfqueryparam cfsqltype="cf_sql_varchar" value="#rereplacenocase(trim(arguments.phone),'[\s\)\(-]','','all')#">
The above query is written inside a function and the value of "arguments.phone" may be (965)-122-4526 or 965-122-4526 or 9651224526
The problem is i am not getting the regular expression which will remove "(" , ")" , "space" , "-" in MSSQL.
can anybody help me?
