Hi,
I have an XML document with a single namespace that I would like to parse and insert into a SQL table with OPENXML. The problem is that I get zero results returned in Query Analyzer.
SET @xml = '
<Root>
<A xmlns=" <B myAttribute="foo"/>
<C>blah</C>
</A>
</Root>'
EXECUTE sp_xml_preparedocument @h OUTPUT, @xml
INSERT INTO myTable
SELECT * FROM OPENXML(@h, 'Root/A/B') WITH (name varchar(50) '@myAttribute')
I tried the statement
EXECUTE sp_xml_preparedocument @h OUTPUT, @xml, '<Root xmlns="
but that also returns zero rows. It works when I take the namespace out all together. How can I make this work with the namespace?
Thanks
I have an XML document with a single namespace that I would like to parse and insert into a SQL table with OPENXML. The problem is that I get zero results returned in Query Analyzer.
SET @xml = '
<Root>
<A xmlns=" <B myAttribute="foo"/>
<C>blah</C>
</A>
</Root>'
EXECUTE sp_xml_preparedocument @h OUTPUT, @xml
INSERT INTO myTable
SELECT * FROM OPENXML(@h, 'Root/A/B') WITH (name varchar(50) '@myAttribute')
I tried the statement
EXECUTE sp_xml_preparedocument @h OUTPUT, @xml, '<Root xmlns="
but that also returns zero rows. It works when I take the namespace out all together. How can I make this work with the namespace?
Thanks