Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OPENXML

Status
Not open for further replies.

kobyashi

Programmer
Apr 25, 2002
3
US
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=&quot; <B myAttribute=&quot;foo&quot;/>
<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=&quot;

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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top