I wrote a function once that does this. Please make changes accordingly,
it's not rocket science.
//================================================
// Formats a string of 10 digits to look like a
// phone number with dashes (-) in the right
// places
//================================================
function strFormatPhoneNumber(str)
{
strReturn = "";
if (len(str) IS 10 OR len(str) IS 11)
{
strReturn = left(str, 3) & "-" & mid(str,4,3) & "-" & right
(str, 4);
}
if (len(str) IS 7 )
{
strReturn = left(str, 3) & "-" & right (str, 4);
}
return strReturn;
}
-----Original Message-----
From: Stephen Hait [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 03, 2001 1:14 PM
To: CF-Talk
Subject: RE: SQL quicky
This is not exactly within a cf sql statement, but...
If you can be sure that your phone numbers are 10 digit strings
you can format your output like this:
<cfset tel="8005551212">
<cfoutput>tel=(#left(tel,3)#) #mid(tel,4,3)#-#right(tel,4)#</cfoutput>
The output would look like this:
tel=(800) 555-1212
> How do I format a phone number (###) ###-#### within my cf sql
> statement? My backend is sql 2000. Thanks in advance.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Get the mailserver that powers this list at http://www.coolfusion.com
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists