In SQL Server 2005, I would like to make one query that checks if all record columns of 2 tables are the same, Example:
declare @tbl1 table(col nvarchar(50))
declare @tbl2 table(col nvarchar(50))
insert into @tbl1
select '11' union select '22'
insert into @tbl2
select '22'
--should return false
declare @tbl1 table(col nvarchar(50))
declare @tbl2 table(col nvarchar(50))
insert into @tbl1
select '11'
insert into @tbl2
select '11' union select '22'
--should return false
declare @tbl1 table(col nvarchar(50))
declare @tbl2 table(col nvarchar(50))
insert into @tbl1
select '11' union select '22'
insert into @tbl2
select '11' union select '22'
--should return true
Using IN
clause, or LEFT JOIN
i'm only able to check if all record columns in one of the tables are present on the other.
Edit: Order is irrelevant
tablediff
for this purpose. dba.stackexchange.com/questions/22385/… – Hannah Vernon♦ May 13 '14 at 17:47