how do i merge two xml fliles into a single xml record

  • we have normalised some xml files from our automated fluke testing system by separating the sections into two tables with fields set to store as xml. one table holding results and the other the proceedures. For recall and display of the results the testing system requires concatination of the two tables xml feild data. Help on A sql statement to merge the two xml files back together is sought.

    The output file needs to be the combination of the proceedure file with the results file inserted between the </template> and the </METRONFile>.

    if you can provide some gudance it would be apprecialted. i can do a lef join and return the data to be post processed by the calling application, but i am seeking a neater more effiicent way of using a sql xml merge processing.

    thanks for any help or guidance

    Greg

  • Anyone got any sugestions?

    these two provided files are xml table field data. i am unable to successfully merge the xml results returned data into the end of the proceedure xml after reading them via a sql select statement

    USE AdventureWorks2008R2;

    GO

    select id, mtrfile from dbo.results

    where id ='1'

    select id, mttfile from dbo.Procedure

    where id ='1'

    DECLARE @myDoc xml;

    SET @myDoc = mttfile;

    DECLARE @newFeatures xml;

    SET @newFeatures = mtrfile;

    -- insert new features from specified variable

    SET @myDoc.modify('

    insert sql:variable("@newFeatures")

    into (/METRONFile)[1] ')

    SELECT @myDoc;

    GO

Viewing 2 posts - 1 through 2 (of 2 total)

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