Format phone number in ms sql server?

In this tutorial, I will explain how to format phone number in ms sql server.

Mysql Phone Number Format is useful when you want to return the phone number in specific format.
sometime we need to format the phone number before displaying them in website.Suppose, we have to format phone number in [(000) 000-0000] format.


Please check below MY SQL Query:
Mysql Phone Number Format


SELECT IF(LENGTH(phone)='10',CONCAT('(',SUBSTRING(phone,1,3),')',SUBSTRING(phone,4,3),'-',SUBSTRING(phone,7,4)),phone) AS phone FROM employees

Now phone number field will show data in this format (000) 000-0000