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.
| Author |
Topic |
|
ramoneguru
Yak Posting Veteran
69 Posts |
Posted - 2006-07-26 : 19:07:39
|
| Ok, here's something I've been having a little problem with lately. Phone numbers. I've stored them all as varchar BUT I didn't place any hyphens between numbers or parenthesis around the area code.If I have numbers stored like aaabbbcccc and I want the query to output it like (aaa) bbb-cccc, how would I go about doing that?? I honestly have no clue.--Nick |
|
|
Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)
7020 Posts |
Posted - 2006-07-26 : 19:42:58
|
| [code]select '('+ substring(phone,1,3)+ ')'+ substring(phone,4,3)+ ... and so on ...[/code]CODO ERGO SUM |
 |
|
|
ramoneguru
Yak Posting Veteran
69 Posts |
Posted - 2006-07-26 : 19:58:17
|
| Damn it, I kept trying something similar to that but couldn't get it right.....shoot, I was on a remotely similar track I suppose. Thanks again MVJ.--Nick |
 |
|
|
LoztInSpace
Aged Yak Warrior
940 Posts |
Posted - 2006-07-26 : 20:14:41
|
| Or format them in the front end where that logic belongs :) |
 |
|
|
|
|
|