SQL Server 2008: how to compare XML?

Is there a way to compare XML variables or columns in SQL Server 2008 that is different than varchar comparisons that can be made from XML values? Some hashing mechanisms?

For example:

declare @xml1 xml = '<Xml1/>' declare @xml2 xml = '<Xml2/>' select case when @xml1 = @xml2 then 1 else 0 end 
+7
source share
1 answer
 select case when cast(@xml1 as nvarchar(max)) = cast(@xml2 as nvarchar(max)) then 1 else 0 end 
+12
source

All Articles