Home Forums Programming XML LOADING COMPLEX XML FILE RE: LOADING COMPLEX XML FILE

  • I have ammended it as below and it is now picking EmployeeID as well. Thanks and God bless. I will give you a shout when I get to other section of the xml. Those are actually more complex than this because up to 20 fields are involved. Once again, thanks.

    DECLARE @xml XML

    SELECT @xml = (SELECT * FROM OPENROWSET(BULK 'd:\chamila\XMLTest\text1.xml', SINGLE_BLOB) x)

    ;with xmlnamespaces ('urn:com.workday/bsvc' as d1p1)

    SELECT t.c.value('(d1p1:Worker_Reference/d1p1:ID[@d1p1:type="Employee_ID"]/text())[1]', 'int') as WorkerID

    , t.c.value('(d1p1:Worker_Reference/@d1p1:Descriptor)[1]', 'varchar(100)') as FullName

    --INTO UserReference4

    FROM @xml.nodes('//d1p1:Worker') t(c)