I am reading data from XML into a table. When I do select from the table, the table is empty.
SET @INPUTXML = CAST(@Attribute AS XML)
EXEC Sp_xml_preparedocument @TestDoc OUTPUT, @INPUTXML
SELECT Row_Number() OVER (ORDER BY Name) AS Row, *
INTO #tData
FROM OPENXML(@TestDoc, N'/DocumentElement/dtData')
WITH (
ID VARCHAR(100) './ID'
, Name VARCHAR(100) './Name'
, Value VARCHAR(max) './Value'
, Column VARCHAR(100) './Column'
)
EXEC Sp_xml_removedocument @TestDoc
Below are my questions:
- select * from #tData is empty table. Why is data not getting populated?
- What does Sp_xml_preparedocument do? When I print @TestDoc, it gives me a number
- What is Sp_xml_removedocument ?