I have a RemoveAlphas function that strips any unwanted characters from a phone number and just leaves the numeric.
Function RemoveAlphas (ByVal AlphaNum as Variant)
Dim Clean As String
Dim Pos, A_Char$
Pos = 1
If IsNull(AlphaNum) Then Exit Function
For Pos = 1 To Len(AlphaNum)
A_Char$ = Mid(AlphaNum, Pos, 1)
If A_Char$ >= "0" And A_Char$ <= "9" Then
Clean$ = Clean$ + A_Char$
End If
Next Pos
RemoveAlphas = Clean$
End Function
I also have an update query
UPDATE Table1 SET Table1.Phone = RemoveAlphas([Phone]);
This is all done in Microsoft Access 2003 but i am wanting to do the same thing in SQL server. I have a very basic knowledge of SQL server and can create tables, write simple queries and have connected to access database.
Where do i put the code in SQL server and will the code need to be changed.
Function RemoveAlphas (ByVal AlphaNum as Variant)
Dim Clean As String
Dim Pos, A_Char$
Pos = 1
If IsNull(AlphaNum) Then Exit Function
For Pos = 1 To Len(AlphaNum)
A_Char$ = Mid(AlphaNum, Pos, 1)
If A_Char$ >= "0" And A_Char$ <= "9" Then
Clean$ = Clean$ + A_Char$
End If
Next Pos
RemoveAlphas = Clean$
End Function
I also have an update query
UPDATE Table1 SET Table1.Phone = RemoveAlphas([Phone]);
This is all done in Microsoft Access 2003 but i am wanting to do the same thing in SQL server. I have a very basic knowledge of SQL server and can create tables, write simple queries and have connected to access database.
Where do i put the code in SQL server and will the code need to be changed.