Finding Missing Rows Between Two Remote Databases

It would take a couple queries, but you could do it in three steps.

  1. Query the stats server to get a list of all the ids that are there, and save it to a file.
  2. Load the id file to a temp table on the primary table, then query for all records where the ids do not match
  3. Run the inserts for all records from step 2 into the stats table.