August 6, 2001 at 10:57 am
The value returned from executing the system stored procedure "sp_xml_removedocument" is 1 indicating an error has occured. The code closely follows examples in BOL and elsewhere. "sp_xml_removedocument" should return 0 just as "sp_xml_preparedocument" does.
If an error has occured then the XML document could still be residing in memory!
The following T-SQL code example illustrates the problem I'm having. I run this code in the query analyzer. I've also compiled it into a stored procedure and received the same result output (i.e. 1). I'm using SQL Server 2000(sp2) on Win2K(sp2).
DECLARE @hdoc int, @return int, @doc varchar(1000), @xmlPath varchar(15)
SET @doc = '
<?xml version="1.0"?>
<root>
<city>lansing</city>
<cntyCode>033</cntyCode>
<output>xml</output>
<rowsToReturn>100</rowsToReturn>
<siteCode>PARMA</siteCode>
</root>'
SET @xmlPath = '/root'
-- load to memory
EXEC @return = sp_xml_preparedocument @hdoc OUTPUT, @doc
PRINT 'Prepare = ' + CAST(@return AS varchar)
-- select all
SELECT *
FROM OPENXML(@hdoc, @xmlPath, 1)
-- remove from memory
EXEC @return = sp_xml_removedocument @hdoc
PRINT 'Remove = ' + CAST(@return AS varchar)
go
August 6, 2001 at 12:31 pm
Just tried it and I get a 1 also as the result code from the removal.
I suspect this is a bug, but I will have to check.
BTW, I assume you mean SQL, SP1
Steve Jones
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy