开发者

SQL Server 2008: How to compare XML?

开发者 https://www.devze.com 2023-02-04 17:48 出处:网络
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?

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 
0

精彩评论

暂无评论...
验证码 换一张
取 消