It can be done in SQL, but I think your easiest approach, assuming this is a one off task, is to write a function which you can modify for each format type you have... something like:
================================================== ================================
Public Function pfunAmendPhoneFormat(strInput As String, strRemove As String) As String
Dim strTemp As String
Dim intLocator As Integer
intLocator = InStr(strInput, strRemove)
Do While intLocator > 0
strTemp = strTemp & Left(strInput, intLocator - 1)
strInput = Right(strInput, Len(strInput) - intLocator)
intLocator = InStr(strInput, strRemove)
Loop
If Len(strInput) > 0 Then strTemp = strTemp & strInput
pfunAmendPhoneFormat = strTemp
End Function
================================================== ================================
strInput is your input string, ie: the Telephone number you want to change "xxx-xxx-xxxx"
strRemove is the specific key you want to remove, ie: "-"
It could probably do with tidying up a bit too, but it seems to do the job. You need to run it through a query to do the update to your table... and you will need to change the strRemove for each type of character you want to remove, but it should put you in the right direction...
Good luck.
|