Explore BrainMass

Explore BrainMass

    SQL server XML to insert and query Products

    This content was COPIED from BrainMass.com - View the original, and get the already-completed solution here!

    Create a table of XML documents with a type of XML. Use a primary key (you can't use an XML type) so add a field of type INT that is an identity.
    Insert several records into the XML field in this new table. Use the following template:

    <ProductDescription ProductID=""ProductName="">

    Once these have been added, modify the structure of XML inside of your XML typed field to add another tag of <Material></Material>
    Within the Features tag, use the "modify" function to make this happen.
    Once this is complete, write an XQuery query using the value clause to return a single record.
    CREATE TABLE script, the INSERT statements, the "modify" script, and the XQuery script.

    © BrainMass Inc. brainmass.com October 10, 2019, 6:28 am ad1c9bdddf

    Solution Preview

    Please find attached SQL script. It will first create a table product with identity ...

    Solution Summary

    The solution contains SQL script that creates database table, inserts a couple of XML records, then runs XPath based queries to update or fetch records.