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 |
WillBJepp
Starting Member
5 Posts |
Posted - 2013-09-23 : 13:02:53
|
SQL query: I am importing data from one source to another. The phone number has 3 variations and I want to standardize the information. I need to remove the "+1" or "1" from the leading characters of the phone number.example:13035554444+13035554444 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-09-23 : 13:08:43
|
RIGHT(field,10)provided it will only include number info and wont contain anything following it------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
sigmas
Posting Yak Master
172 Posts |
Posted - 2013-09-23 : 13:12:48
|
stuff (replace(value,'+',''),1,1,'')case when charindex('+1',value)=1 then substring(value,3,len(value)-2) when charindex('1',value)=1 then substring(value,2,len(value)-1) else value end |
|
|
WillBJepp
Starting Member
5 Posts |
Posted - 2013-09-23 : 14:08:13
|
quote: Originally posted by visakh16 RIGHT(field,10)provided it will only include number info and wont contain anything following it------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs
This was perfect. Thank you. |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-09-23 : 14:11:45
|
Welcome------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|
|
|