I want to parse out the "Sam" value for a xml text similar to:
< xml version="1.0" encoding="utf-16" >
<root>
<Customer>Sam</Customer>
<Success>true</Success>
</root>
Without the declaration, I can do it like:
DECLARE
@idoc intDECLARE
@doc varchar(1000)SET @doc ='
<root>
<Customer>Sam</Customer>
<Success>true</Success>
</root>
'
EXEC
sp_xml_preparedocument @idoc OUTPUT, @doc-- Execute a SELECT statement using OPENXML rowset provider.
SELECT
*FROM
OPENXML (@idoc, '/root', 2) WITH (Customer ntext)
EXEC
sp_xml_removedocument @idoc
Also it needs SQL Server 2000 compatible.