I have a remarkably funny little SQL problem to solve today, and I thought I'd ask the community to see what solutions you came up with.
We have a really cool email for the text service we use, you just need to send an email to phonenumber@servicename.com and it will send a text message to the desired phone number.
For example, to send text to number 0790 0006006, you need to send an email to number 07900006006@servicename.com , pretty neat huh?
Problem with phone numbers in our database. Most phone numbers are fine, but some have junk mixed with the phone number.
Take these great examples of garbage that you need to deal with (I anonymized phone numbers by setting zeros):
07800 000647 (mobile)
07500 000189 USE 1ST SEE
NOTES
07900 000415 HO ONLY
try 1st 0770 0000694, then go home
07500 000465 Cannot
Requirements
The solution should be in SQL (for MS SQL server).
So, the task is this: we need to get a phone number without spaces and without any garbage seen in the samples.
For instance:
It:
try 1st 0770 0000694 then home
Should be as follows:
07700000694
, (, ". " ) .
UPDATE:
! , , , SQL , . , .
, - , .