Would a FULL OUTER JOIN help?
I changed your sample data to get some results.
-- sample data
DECLARE @table1 TABLE (id int identity, content int NOT NULL, primary key(id, content));
DECLARE @table2 TABLE (id int identity, content int NOT NULL, primary key(id, content));
INSERT @table1(content) VALUES (12), (15), (20);
INSERT @table2(content) VALUES (13), (15), (20);
--DELETE TOP(1) FROM @table1;
--DELETE TOP(1) FROM @table2;
--solution
(
SELECT id, content FROM @table1
EXCEPT
SELECT id, content FROM @table2
)
UNION ALL
(
SELECT id, content FROM @table2
EXCEPT
SELECT id, content FROM @table1
);
SELECT ISNULL( t1.id, t2.id) AS id,
ISNULL( t1.content, t2.content) AS content
FROM @table1 t1
FULL OUTER
JOIN @table2 t2 ON t1.id = t2.id AND t1.content = t2.content
WHERE t1.id IS NULL
OR t2.id IS NULL;
Or maybe using HAVING:
SELECT *
FROM (
SELECT id, content FROM @table1
UNION ALL
SELECT id, content FROM @table2
) x
GROUP BY id, content
HAVING COUNT(*) = 1;