It will be hit-or-miss. I would move the data in stages, starting with strong matching criteria, and move to weaker criteria. At each stage, first do a SELECT to see that the rows you wish to change are the only ones retrieved.
First match "Doe, John" and "Doe, John"
This is a strong match.
Check with
Code:
SELECT o.empid,
o.firstname, n.firstname,
o.lastname, n.firstname
FROM MyNewTable n
JOIN MyOldTable o ON o.firstname = n.firstname
AND o.lastname = n.lastname
WHERE n.empid IS NULL
There should be no duplicates for the o.empid. If there are then you have two people with the same name.
If it looks good then
Code:
UPDATE MyNewTable SET empid = o.empid
FROM MyNewTable n
JOIN MyOldTable o ON o.firstname = n.firstname
AND o.lastname = n.lastname
WHERE n.empid IS NULL
Then match partially. For example
Code:
SELECT o.empid,
o.firstname, n.firstname,
o.lastname, n.firstname
FROM MyNewTable n
JOIN MyOldTable o ON o.firstname LIKE n.firstname & "*"
AND o.lastname = n.lastname
WHERE n.empid IS NULL
Here the match is based on the new firstname being the beginning pieces of the old firstname. That is, matches new "John" to old "John M", "John J", "John", "John t", etc.
The WHERE clause limits the damage, excuse me, the changes to rows which have not yet been matched.
In the end it may be necessary to manually decide which records match and enter the id.