Explore BrainMass
Share

SQL server XML to insert and query Products

This content was STOLEN 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:

<Root>
<ProductDescription ProductID=""ProductName="">
<Features>
<Warranty></Warranty>
<Maintenance></Maintenance>
</Features>
</ProductDescription>
</Root>

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 17, 2018, 11:35 am ad1c9bdddf
https://brainmass.com/computer-science/data/sql-server-xml-to-insert-and-query-products-545309

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.

$2.19
Similar Posting

Programming Guidelines

You found that you are really enjoying this project and maybe see programming as a future career. You realize though, that if you were a programmer in a large company, you would be part of a large programming team and perhaps work on multiple projects. You are the only one working on this specific program, so you know how each part works and all the names for the programs and variables. For a large programming team, this is not the case.

You wonder how large programming teams make sure that they use the same naming conventions and that their programs work together even though they are created independently. You research the Internet and any resources at your disposal for information on how large programming teams accomplish these tasks.

View Full Posting Details