SitePoint Sponsor |
|
User Tag List
Results 1 to 3 of 3
Thread: format text field in sql
-
May 12, 2004, 13:37 #1
format text field in sql
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.
-
May 12, 2004, 18:20 #2
- Join Date
- Jul 2002
- Location
- Toronto, Canada
- Posts
- 39,347
- Mentioned
- 63 Post(s)
- Tagged
- 3 Thread(s)
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
-
May 13, 2004, 06:17 #3
Thanks for the help!
Originally Posted by r937
Bookmarks