DECLARE @idoc int
DECLARE @doc varchar (1000)
SET @doc ='
<ROOT>
<ShipperRec Company="ABC Shippers" Ph="(503) 555-9191" />
</ROOT>'
--Create an internal representation of the XML document
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
-- Execute a SELECT statement that uses the OPENXML rowset provider
SELECT *
FROM OPENXML (@idoc, '/ROOT/ShipperRec',1)
WITH (Company varchar(80),
Ph varchar(48)
)
-- Clear the XML document from memory
EXEC sp_xml_removedocument @idoc
DECLARE @doc varchar (1000)
SET @doc ='
<ROOT>
<ShipperRec Company="ABC Shippers" Ph="(503) 555-9191" />
</ROOT>'
--Create an internal representation of the XML document
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
-- Execute a SELECT statement that uses the OPENXML rowset provider
SELECT *
FROM OPENXML (@idoc, '/ROOT/ShipperRec',1)
WITH (Company varchar(80),
Ph varchar(48)
)
-- Clear the XML document from memory
EXEC sp_xml_removedocument @idoc
No comments:
Post a Comment