[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

4.2

Loading XML straight into the DB

Asked by jasww in Extensible Markup Language (XML), Extensible HTML (XHTML)

Tags: xml

Hi
I have been tasked with loading some relational data into the database.  I want to utilise the XML-based power of Ado.net.
I can write out data expressed in two tables to XML easily enough when there is a PK-FK relationship between the two source tables.

The XML could be an object serialised to file, or it could be a dataset from someone else's DB.

The tables look like this:

Parent
  Parent_id (PK, uniqueidentifier)
  Parent_A
  Parent_B
  Parent_Z (has a default value)

Child:
   Child_ID  (PK, uniqueidentifier)
   Child_Parent_Id (FK, uniqueidentifier)
   Child_X
   Child_Y
   Child_Z (has a defualt value)

The select staement to use is of course
       select * from Parent inner join child on parent.parent_id = child.child_parent_id
 

But what about loading data from XML into the DB when the XML source data is nested but there are no IDs?

e.g.
<dataset>
   <parent>
      <A>   I am A </A>
      <B>   I am B </B>
      <childrow>  
            <X>I am x </Y>
            <Y>I am y </Y>
      </childrow>
      <childrow>  
            <X>I am another x </Y>
            <Y>I am another y  </Y>
      </childrow>
   <parent>
</dataset>

 

There can be 1+ children per parent.  


Please advise how to load this XML into the relational database, taking care to note that:
   a) source tag names are not necissarily the same as the target column names
   b) source tag names for child and parent are not necessarily the same as the target table names in the DB
   c) IDs used for PK and FK in the resulting tables are uniqueidentifiers.
  d) there are additional columns in the tables which do not have nodes in the XML (but these columns have default values)



Many thanks
Daniel


ps.  SQL 2000, VS2003, .net 1.1, windows server 2003.
[+][-]11/19/06 05:33 PM, ID: 17976607Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Extensible Markup Language (XML), Extensible HTML (XHTML)
Tags: xml
Sign Up Now!
Solution Provided By: DarthMod
Participating Experts: 2
Solution Grade: B
 
[+][-]11/03/06 01:01 PM, ID: 17870172Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/03/06 01:11 PM, ID: 17870235Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/03/06 01:12 PM, ID: 17870243Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/03/06 01:16 PM, ID: 17870276Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/03/06 01:21 PM, ID: 17870312Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/03/06 01:23 PM, ID: 17870319Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/03/06 01:26 PM, ID: 17870345Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/03/06 01:37 PM, ID: 17870406Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/03/06 01:49 PM, ID: 17870504Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/10/06 07:49 AM, ID: 17915033Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/10/06 07:54 AM, ID: 17915096Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/10/06 08:05 AM, ID: 17915203Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/10/06 08:07 AM, ID: 17915224Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/10/06 10:00 AM, ID: 17916388Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/10/06 11:45 AM, ID: 17917109Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/10/06 12:51 PM, ID: 17917619Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/14/06 10:14 AM, ID: 17940136Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/15/06 06:39 AM, ID: 17947163Administrative Comment

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-92