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 |
wsilage
Yak Posting Veteran
82 Posts |
Posted - 2013-04-03 : 09:16:35
|
I know this is probably something simple, but I tried googling it and didn't find anything. I have a field that has the phone and extension on in one.How can I put a space after the phone numberThis is what it looks like in my file....215456700040081I want it to look lik this...2154567000 40081This is what I tried to do...left(c.CorrespondancePhone, 10) |
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2013-04-03 : 09:27:12
|
if ext is always at the end and is of five digit then declare @a varchar(20)SET @a='215456700040081'SELECT Replace(@a,Right(@a,5),'')+' '+Right(@a,5)CheersMIK |
|
|
wsilage
Yak Posting Veteran
82 Posts |
Posted - 2013-04-03 : 09:38:59
|
Thanks I will try that. I am not sure if the ext will only ever be 5 digits. |
|
|
russell
Pyro-ma-ni-yak
5072 Posts |
Posted - 2013-04-03 : 10:23:40
|
declare @a varchar(20)SET @a='2154567000400812'SELECT LEFT(@a, 10) + ' ' + RIGHT(@a, len(@a)-10) |
|
|
MIK_2008
Master Smack Fu Yak Hacker
1054 Posts |
Posted - 2013-04-03 : 10:44:33
|
so if the phone number is always at start and going to be of 10 digits, then use Russel's one :DCheersMIK |
|
|
|
|
|