IF ( SELECT CHECKSUM_AGG(BINARY_CHECKSUM(*)) FROM ( -- first resultset to compare SELECT * FROM Person.Address ) t1 ) = ( SELECT CHECKSUM_AGG(BINARY_CHECKSUM(*)) FROM ( -- second resultset to compare SELECT * FROM Person.Address WHERE AddressID < 1000 ) t1 ) BEGIN SELECT 'Resultsets equal' ENDELSE BEGIN SELECT 'Resultsets NOT equal' END