sql - Check for equality on a phone number inputted in a variety of formats -


is a phone number table that stores the number in the form of user input (eg 555 555 5555, 555-555 -5555, 555.555.5555)

We register those numbers with a 3-rd party service, then the consumer is one of our web services, but only 10 points (5555555555) Offers.

> I have to find a match, but my records need to filter non-alphanumeric characters.

I added a function that draws non-alphanumeric characters here:

I have the following, but I always get 0 records, although I have 555 for a record in the table -555-5555 is the value:

  SELECT COUNT (*) FROM [dbo] [Phone number] WHERE [DBO] [RemoveNonAlphaCharacters] ([number]) = '5555555555'  

Em> non-alphabet characters are sorted out like this:

  create function [dbo]. [RemoveNonAlphaNumCharacters] (@Tharm Verarkar (8000)) Announcing the return as VarChar (800) @KeepValues ​​varchar (50) set @KeepValues ​​= '% [^ A-zA-Z0-9] % 'While Pat Index (@ Child Wells, @ Temple) & gt; 0 set @Temp = Stuff (@Temp, PatIndex (@KeepValues, @Temp), 1, '') @Temp End Return;  

Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -