Saturday, January 1, 2011

Inserting XML Through Bulk Load

Inserting XML Through Bulk Load

XML Bulk Load allows you to load semistructured XML data into Microsoft SQL Server.
You can insert XML data into a SQL Server database by using an INSERT statement and the OPENXML function. This bulk load utility provides higher performance when you need to insert large amounts of XML data.

CREATE TABLE bulktable1(XmlCol xml)
go

-- One row affected (one or multiple nodes)
INSERT into bulktable1(XmlCol)
SELECT *
FROM OPENROWSET(Bulk 'C:\xmltype\demo\SampleData2.txt',
           SINGLE_CLOB) as x
go


import_xml_sqlserver


















The input Xml file is

input xml file

No comments:

Post a Comment