Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Strip specific part of field

Status
Not open for further replies.

ashab02

Programmer
Jun 28, 2005
87
GB
Hello

I hope some one can help

I have a field which has a number of values in it

I would like to strip the specic vales out one by one. Thye contain telephone numbers and an example is below

'8888 8888 (Home) : 07777777777 (Mobile)'

The format is just like the above.
Can someone tell me how I can do this?

Shab
 
Hello
Basically I want to strip just the numbers and put them in new fields, so home to go under home_tel_number, and mobile to go under mobile filed. these fields already exist and the file I have is an update file but its formated like the above.

Hope you can help
 
Is home always the first number and mobile always the second? If not I think it would involve quite a few steps.
 
Yes the numbers will always be in that format.

what do you think, can it be done?
 
if it's always that format, take a look at this
Code:
declare @v varchar(49)
select @v= '8888 8888 (Home) : 07777777777 (Mobile)'

select left(replace(replace(@v,'(Mobile)',''),' ',''),8) as home,
right(replace(replace(@v,'(Mobile)',''),' ',''),11) as mobile

Denis The SQL Menace
SQL blog:
Personal Blog:
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top