Compare contents of two XML files

  • Hi,

    I have to compare XML contents in column A in Table A in Database A with XML contents in column B in Table B in Database B.

    Basically I want to see if the contents of XML files equal or different.

    Can please provide me a sample SQL Query to achieve this ?

    Thanks,

     

    • This topic was modified 5 years, 3 months ago by  gana79950.
  • Can you provide sample DDL and data, please? In the form of INSERT statements.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • You also need to specify what you mean by "equal or different".  XML files can contain exactly the same information, but have a slightly different layout.  Are they equal because they have the same information or are they different, because they have a different layout.  For example

    <person>
    <first>James</first>
    <last>Bond</last>
    </person>

    and

    <person>
    <last>Bond</last>
    <first>James</first>
    </person>

    are semantically equal, but have different layouts.

    Also, XML is case-sensitive.  Does that matter for your purposes?

    Drew

    J. Drew Allen
    Business Intelligence Analyst
    Philadelphia, PA

  • May be I will first try comparing one field value, which I know it should be there if the are for same transaction.

    Please advise.

  • gana79950 wrote:

    Please advise.

    Advise what, exactly?

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

  • script to compare one field value in two xml files.

  • gana79950 wrote:

    script to compare one field value in two xml files.

    Can you provide sample DDL and data, please? In the form of INSERT statements.

    The absence of evidence is not evidence of absence.
    Martin Rees

    You can lead a horse to water, but a pencil must be lead.
    Stan Laurel

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply