We help IT Professionals succeed at work.
Get Started

Parsing the XML data to SQL Server

Last Modified: 2016-09-30
I have dozens of these kind of file from a client that I need to store in the database as separate columns and other important identifier information.

How can I extract the Question: What is the color of Orange and 4 response options for it? I also want to extract all information from the "key" node with values in the ID, EVAL attribute as well.

<TestItem  CLASS="MOAT" METHOD="Multiple">
  <div id="stim" style="width:455px;text-align:center;margin:10px 10px 10px 0px;height:580px;background-color:#ffffff;padding:10px;">
    <div style=" margin:10px; text-align:center;background-color:#ffffff;">
          <td valign="middle" align="right">
            <img src="../images/test1/test1.jpg" />
          <td valign="middle" align="left">
            <div class="inItemEnclosedbubble">
              What is the color of Orange?
      <div style="text-align:left;margin:auto;">
<div style="height:30px"></div>
      <ssmcblock ID="TEST_81330">
        <distractor ID="A">
          <div class="innerDistractor">
        <distractor ID="B">
          <div class="innerDistractor">

        <distractor ID="C">
          <div class="innerDistractor">


        <distractor ID="D">
          <div class="innerDistractor">



    <part ID="TEST_81330" EVAL="TESTMC">4</part>
Watch Question
Database Expert
Awarded 2016
Top Expert 2016
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE