I'd like to format a text field into a phone number format.
For example:
SQL currently spits out 4444444444
I need it to output (444) 444-4444
I've used the date_format but don't know of one for dealing with text.
Printable View
I'd like to format a text field into a phone number format.
For example:
SQL currently spits out 4444444444
I need it to output (444) 444-4444
I've used the date_format but don't know of one for dealing with text.
Code:select textphoneno
, concat( '('
, substring(textphoneno from 1 for 3)
, ') '
, substring(textphoneno from 4 for 3)
, '-'
, substring(textphoneno from 7 for 4)
) as formattedphoneno
from yourtable
Thanks for the help!
Quote:
Originally Posted by r937