I have phone number field in either of these two formats (xxx)xxxxxxx or (xxx)xxx-xxxx
I want to extract and format the number as xxxxxxxxxx, number only. Is there a simple way in sql select statement?
I have phone number field in either of these two formats (xxx)xxxxxxx or (xxx)xxx-xxxx
I want to extract and format the number as xxxxxxxxxx, number only. Is there a simple way in sql select statement?
It is always difficult to answer coding questions without an example of the code with which you are working. That being said, something like this might be what you are look for:
SELECT
[Phone Numbers]
,FORMAT([Phone Numbers],'(##########') AS [Formatted Phone]
FROM tbl_sample
SELECT
column_sample,
REPLACE(REPLACE(REPLACE(phone , '(', '') , ')', '') , '-', '') as phone
FROM tbl_sample;