Hi,I have a field that holds xml in a field type xml called xmlcontent. I am trying to use xquery to get all the partno's and its preceding-sibling cage. However I receive this error:Error:XQuery [tbl_sometable.xmlcontent.value()]: Cannot implicitly atomize or apply 'fn:data()' to complex content elements, found type 'xs:anyType' within inferred type 'element(geeps{http://www.geeps/schema}:cage,xs:anyType) ?'.XML stored in column:<geeps:root xmlns:geeps="http://www.geeps/schema"> <geeps:data1> <geeps:subdata>123234</geeps:subdata> </geeps:data1> <geeps:data2> <geeps:cage>09998</geeps:cage> <geeps:part_number>12234</geeps:part_number> </geeps:data2> <geeps:data2> <geeps:cage>04568</geeps:cage> <geeps:part_number>1ASD4</geeps:part_number> </geeps:data2> <geeps:data2> <geeps:cage>ASBB7</geeps:cage> <geeps:part_number>ZZZSSD4</geeps:part_number> </geeps:data2></geeps:root>
SQL:SELECT T.c.value('declare namespace geeps="http://www.geeps/schema";(.)[1]', 'varchar(100)') AS Partno,T.c.value('declare namespace geeps="http://www.geeps/schema";(../geeps:cage)[1]', 'varchar(100)') AS cagenoFROM tbl_sometableCROSS APPLY xmlcontent.nodes('declare namespace geeps="http://www.geeps/schema"; (/geeps:root/geeps:data2/geeps:part_number)') T(c)