SELECT ISNULL(d1.TableName,d2.TableName) as TableName,
d1.[RowCount],
d2.[RowCount]
FROM Dataset1 as d1
FULL JOIN Dataset2 as d2
ON d1.TableName = d2.TableName
WHERE
ISNULL(d1.[RowCount],0) <> ISNULL(d2.[RowCount],0);
just exercising my noodles ... thinking of all different ways to do it
SELECT
TableName
, min(row_count)
, max(row_count)
FROM
(
(select * from #Dataset1 except select * from #Dataset2)
union all
(select * from #Dataset2 except select * from #Dataset1)
) a
GROUP BY
tablename
drop table #Dataset1
create table #Dataset1 ( TableName varchar(10) , Row_Count int )
insert into #Dataset1 select 'Table-1', 12
insert into #Dataset1 select 'Table-2', 15
insert into #Dataset1 select 'Table-3', 18
select * from #Dataset1
drop table #Dataset2
create table #Dataset2 ( TableName varchar(10) , Row_Count int )
insert into #Dataset2 select 'Table-1', 12
insert into #Dataset2 select 'Table-6', 15
insert into #Dataset2 select 'Table-3', 10
select * from #Dataset2
SELECT
tablename
, row_count
, count(*)
FROM
(
select * from #Dataset1
union all
select * from #Dataset2
) a
GROUP BY
TableName
, row_count
HAVING
count(*) = 1