SQL Server 2008: How to compare XML?
Is there are way to compare variables or columns of XML in SQL Server 2008, which 开发者_高级运维is different from comparing a varchar that can be made from the XML value? Some hashing mechanisms?
For example:
declare @xml1 xml = '<Xml1/>'
declare @xml2 xml = '<Xml2/>'
select case when @xml1 = @xml2 then 1 else 0 end
select case when cast(@xml1 as nvarchar(max)) = cast(@xml2 as nvarchar(max)) then 1 else 0 end
精彩评论