This is my first time I ran this query:
code:
--put xml in variable
DECLARE @docs XML =
'<Students>
<Student StudentID="1">
<StudentName>
<First>AHMED</First>
<Second>ALI</Second>
</StudentName>
<Address>CAIRO</Address>
</Student>
<Student StudentID="2">
<StudentName>
<First>OMAR</First>
<Second>SAAD</Second>
</StudentName>
<Address>ALEX</Address>
</Student>
</Students>'
--create document handle
DECLARE @hdocs INT
--create memory tree
EXEC sp_xml_preparedocument @hdocs OUTPUT, @docs
--read tree from memory
SELECT * INTO NewTable
FROM OPENXML (@hdocs, '//Student') --levels XPATH Code
WITH (StudentID INT '@StudentID',
[Address] VARCHAR(10) 'Address',
StudentFirst VARCHAR(10) 'StudentName/First',
StudentSECOND VARCHAR(10) 'StudentName/Second')
--remove memory tree
EXEC sp_xml_removedocument @hdocs
`
but I found this error:
Msg 6610, Level 16, State 1, Procedure sp_xml_preparedocument, Line 1 [Batch Start Line 291]
Failed to load Msxmlsql.dll.
Msg 8179, Level 16, State 5, Line 316
Could not find prepared statement with handle 0.
The statement has been terminated.
Msg 6607, Level 16, State 3, Procedure sp_xml_removedocument, Line 1 [Batch Start Line 291]
sp_xml_removedocument: The value supplied for parameter number 1 is invalid.
I tried to search for it with nothing achieved, hope you help me guys
tried all of these https://www.sqlservercentral.com/forums/topic/failed-to-load-msxmlsql-dll ,https://www.sqlteam.com/forums/topic.asp?TOPIC_ID=98806,https://kcm.trellix.com/corporate/index?page=content&id=KB65367&locale=en_US and more
Coin shot is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.