Transact-SQL Reference
sp_xml_removedocument
Removes the internal representation of the XML document specified by the document handle and invalidates the document handle.
Note A parsed document is stored in the internal cache of Microsoft® SQL Server™ 2000. The MSXML parser uses one-eighth the total memory available for SQL Server. To avoid running out of memory, run sp_xml_removedocument to free up the memory.
Syntax
sp_xml_removedocument hdoc
Arguments
hdoc
Is the handle to the newly created document. An invalid handle returns an error. hdoc is an integer.
Return Code Values
0 (success) or >0 (failure)
Permissions
Execute permissions default to the public role.
Examples
A. Remove an XML document
This example removes the internal representation of an XML document. The handle to the document is provided as input.
EXEC sp_xml_removedocument @hdoc