Monday, February 20, 2012

OPENXML problem

Hello:
I am leaning to useOPENXML in my queries, but I keep encountering problems:
This is the code:
========================================================
DECLARE @.xml_text VARCHAR(200)
DECLARE @.i INT

SET @.xml_text = '
<ROOT>
<CODE>HAMHE</CODE>
<CODE>MENHE</CODE>
<CODE>REGCA</CODE>
<CODE>SLAGI</CODE>
</ROOT>'

EXEC sp_xml_preparedocument @.i OUTPUT, @.xml_text

SELECT *
FROM OPENXML(@.i, '/ROOT/CODE', 2)
WITH CODE

EXEC sp_xml_removedocument @.i

====================================================
all I want is to return a return a result like this:
HAMHE
MENHE
REGCA
SLAGI

but it keeps giving me error:
"Server: Msg 208, Level 16, State 98, Line 129
Invalid object name 'CODE'."

Could anybody help me pls? thank you

Try the first two links I posted in this thread for working OPENXML code samples. Hope this helps.
http://forums.asp.net/1059240/ShowPost.aspx

No comments:

Post a Comment