How to insert in Sql Server 2000 database table a XML document String
Nov 5th, 2007 by Onyrix 501 Views |
Email This Post
|
Print This Post
DECLARE @idoc int
DECLARE @doc nvarchar(300)
SET @doc =
‘<?xml version=”1.0″ ?>
<ROOT>
<Shippers ShipperID=”4″ CompanyName=”The RoadRunner” Phone=”(503) 666-9831″/>
<Shippers ShipperID=”5″ CompanyName=”Speedy Gonzalez” Phone=”(503) 666-3199″/>
</ROOT>’
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc INSERT Northwind..Shippers
SELECT *
FROM OPENXML (@idoc, N’/ROOT/Shippers’)
WITH Northwind..Shippers
EXEC sp_xml_removedocument @idoc

del.icio.us
Digg
Furl
Reddit
Technorati