Find All Rows in Table1 That Are Not in Table2 Using JOIN
To find all rows that are in dbo.TABLE1 but not in dbo.TABLE2 using the SQL JOIN operator:
SELECT COUNT(*) FROM dbo.TABLE1 t1 WITH (NOLOCK) LEFT OUTER JOIN dbo.TABLE2 t2 WITH (NOLOCK) ON t1.PrimaryKey = t2.PrimaryKey WHERE t2.PrimaryKey IS NULL