I have a SqlServer customer table
customer (first_name, last_name, home_phone, cell_phone)
and a text file list of phone numbers like
9876543210,
4564561234,
1231231234,
1234567890,
The phone numbers in the customer table are stored in the format +1dddddddddd: where dddddddddd is the phone number.
How can I find all the customer records where the home or cell phone number appears in the text list?
The text list is about a 1000 numbers long so ideally I would only want to paste them once. How could I create a temporary table of the numbers to do the query on?
SELECT first_name, last_name
FROM customer
WHERE home_phone IN (
SELECT * FROM temporary_table
)
But that doesn't match the customer phone number format and only checks against the home phone number and not the cell phone number as well.