There is a PhoneNumber table which stores the number as the user has input it (e.g. 555 555 5555, 555-555-5555, 555.555.5555)
We register those numbers with a 3-rd party service, which then consumers one our web services, but only provides the number as 10 digits (5555555555).
I need to find a match but filtering out the non-alphanumeric characters in my records.
I added the function that strips out non-alphanumeric characters here: How to strip all non-alphabetic characters from string in SQL Server?
I tried running the following, but I always get 0 records, though I have a 555-555-5555 value for a record in the table:
SELECT COUNT(*)
FROM [dbo].[PhoneNumber]
WHERE [dbo].[RemoveNonAlphaCharacters]([Number]) = '5555555555'