XmlCompare
Compares two XML strings
- Free Function
- SQL Server Compatibility: 2008, 2012, 2014, 2016, 2017
SELECT SQLHTTP.net.XmlCompare( @Xml1, @Xml2 )
Name | Type | Description |
---|---|---|
@Xml1 | xml | First XML to be compared. |
@Xml2 | xml | Second XML to be compared. |
bit
0 = The two XML strings ARE NOT the same.
1 = The two XML strings ARE the same.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
DECLARE @Xml1 xml DECLARE @Xml2 xml SET @Xml1 = '<?xml version="1.0" encoding="UTF-8"?><DocumentElement param="value"><FirstElement>¶ Some Text</FirstElement><?some_pi some_attr="some_value"?><SecondElement param2="something">Pre-Text <Inline>Inlined text</Inline> Post-text.</SecondElement></DocumentElement>' SET @Xml2 = '<?xml version="1.0" encoding="UTF-8"?> <DocumentElement param="value"> <FirstElement> ¶ Some Text </FirstElement> <?some_pi some_attr="some_value"?> <SecondElement param2="something"> Pre-Text <Inline>Inlined text</Inline> Post-text. </SecondElement> </DocumentElement>' SELECT SQLHTTP.net.XmlCompare(@Xml1, @Xml2) |
1 2 3 4 5 |
----- 1 |