Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Number conversion?

Author  Topic 

Rasta Pickles
Posting Yak Master

174 Posts

Posted - 2012-04-26 : 14:35:03
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

15732 Posts

Posted - 2012-04-26 : 14:52:12
SELECT '(' + STUFF(STUFF(PHONE_NOS,6,0,'-'),3,0,') ') FROM CUSTOMER_DETAILS
Go to Top of Page

Rasta Pickles
Posting Yak Master

174 Posts

Posted - 2012-04-26 : 15:04:14
Outstanding, thank you.
Go to Top of Page
   

- Advertisement -