I've been asked to cross reference some phone records with the SQL database. I've imported the spread sheet into a temporary table with the idea of checking the phone number and returning the name (either employee name or supplier name). I've been staring at this for 2 hours now and I'm a little confused as thow to actually achieve it...
A poor attempt I know, but this is what I've got so far...
DECLARE @Callee_Name VarChar(30) BEGIN INSERT INTO TempPhoneRec$([Callee Name]) VALUES (@Callee_Name, ( SELECT EmployeeName FROM Empoyee JOIN TempPhoneRec$ ON (REPLACE(empPhoneRec$.Callee, ' ', '')) = (REPLACE(Employee.Phone_LL, ' ', '')) OR (REPLACE(empPhoneRec$.Callee, ' ', '')) = (REPLACE(Employee.Phone_Mobile, ' ', '')) )) END
Any pointers or advice as to which would be the best way to achieve this...?