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

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Conversion of phone string to number

Author  Topic 

WindChaser
Posting Yak Master

225 Posts

Posted - 2012-03-15 : 23:26:00
Hi folks,

The only way that I've thought of to convert a phone string such as (212) 555-1212 into 2125551212 has been the following:

SELECT REPLACE(REPLACE(REPLACE(REPLACE(Phone, '(', ''), ')', ''), '-', ''), ' ', '') AS PhoneNumber FROM MyTable

But I figure that there's got to be a more efficient way. Any ideas would be appreciated. Thanks!

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2012-03-15 : 23:34:36
try this

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=79083&SearchTerms=fnFilterString


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -