Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2006
    Posts
    26

    Question Unanswered: OPen xml rowpattern probs!

    Hi All,

    I have this sql syntax which displays the records within the xml but instead of displaying 4 records (3 records relating to the last question ID) but instead resulting in only two records picking only the first options 'Unhelpful'.

    Definitely doing something wrong here, please advise!

    DECLARE @doc xml
    SET @doc =
    '<DivisionName>
    <QuestInfo Custref="18759" SubDate="2006-01-01T00:00:00"
    Polref="30018759" AgentID="4189" ClaimRef="14024-5647-890"/>
    <DVName>Ho</DVName>
    <DvcodeNo>1</DvcodeNo>
    <ClaimGroup>
    <CustSurveyNo>4</CustSurveyNo>
    <ClaimGroupType>Water</ClaimGroupType>
    <Questions>
    <QuestionID>45</QuestionID>
    <Answer>
    <AnswerID>43</AnswerID>
    <Ansoption />
    </Answer>
    </Questions>
    <Questions>
    <QuestionID>34</QuestionID>
    <Answer>
    <AnswerID>13</AnswerID>
    <Ansoption>
    <Options>Unhelpful</Options>
    </Ansoption>
    </Answer>
    </Questions>
    </ClaimGroup>
    </DivisionName>'


    DECLARE @docHandle int


    EXEC sp_xml_preparedocument @docHandle OUTPUT, @doc


    SELECT *
    FROM
    OPENXML(@docHandle, '/DivisionName/ClaimGroup/Questions/Answer/
    Ansoption', 2)
    WITH
    (DVName varchar (20) '../../../../DVName',
    DvcodeNo int '../../../../DvcodeNo',
    CustSurveyNo int '../../../CustSurveyNo',
    ClaimGroupType varchar (20) '../../../ClaimGroupType',
    QuestionID int '../../QuestionID',
    AnswerID int '../AnswerID',
    Ansoption varchar (30)'Options')


    EXEC sp_xml_removedocument @docHandle

  2. #2
    Join Date
    Feb 2006
    Posts
    26
    Don't worry all sorted

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •