[SQL ] how to format the phone number in SQL Server 2005?

看板Database作者 (我是強尼‧大門的球迷XDD)時間17年前 (2008/05/30 07:20), 編輯推噓1(101)
留言2則, 2人參與, 最新討論串1/1
I have trouble with that. like (###) ###-####. from the homework. "List the phone number from the authors table. Format the phone number as left bracket followed by the area code followed by the right bracket followed by the phone number." I know that SELECT phone FROM author however, the results will be like 408 496-7223 but I do not know how to format the phone number. can you help me to figure it out please? thanks. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 154.20.173.137

05/30 13:19, , 1F
select '('+left(phone,3)+')'+
05/30 13:19, 1F

05/30 13:41, , 2F
thank you.
05/30 13:41, 2F
文章代碼(AID): #18FpedRB (Database)