Home Forums Programming XML Issue ,Getting Only One Child Node by sp_xml_preparedocument. RE: Issue ,Getting Only One Child Node by sp_xml_preparedocument.

  • Not Able to get Assistant days now by open xml

    DECLARE @Payrollhandle int

    DECLARE @Payrolldoc VARCHAR(MAX)=

    ('<Payroll StartDate="2013-10-30" EndDate="2013-10-31">

    <Doctor ID="74962">

    <WorkDays>

    <Office ID="60101" Days="23"/>

    <Office ID="60102" Days="23"/>

    </WorkDays>

    <AsstDays>

    <Office ID="60101" Days="23"/>

    <Office ID="60102" Days="23"/>

    </AsstDays>

    </Doctor>

    </Payroll>')

    EXEC SP_xml_preparedocument @Payrollhandle OUTPUT,@Payrolldoc

    SELECT

    * FROM

    OPENXML(@Payrollhandle,'Payroll/Doctor/WorkDays/Office',8)

    WITH (DoctorID INT '../../@ID',

    WorkDaysOfficeID VARCHAR(10) './@ID',

    AsstDaysOfficeID VARCHAR(10) '../../AsstDays/Office/@ID'

    )

    AS A