SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Number conversion?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Rasta Pickles
Posting Yak Master

United Kingdom
133 Posts

Posted - 04/26/2012 :  14:35:03  Show Profile  Reply with Quote
How do I convert the output 5551234567 to (555) 123-4567?

The query is a simple

SELECT PHONE_NOS FROM CUSTOMER_DETAILS

robvolk
Most Valuable Yak

USA
15559 Posts

Posted - 04/26/2012 :  14:52:12  Show Profile  Visit robvolk's Homepage  Reply with Quote
SELECT '(' + STUFF(STUFF(PHONE_NOS,6,0,'-'),3,0,') ') FROM CUSTOMER_DETAILS
Go to Top of Page

Rasta Pickles
Posting Yak Master

United Kingdom
133 Posts

Posted - 04/26/2012 :  15:04:14  Show Profile  Reply with Quote
Outstanding, thank you.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000