MSDN WebCast Demo: Loading XML data
-- Loading
-- Execute every statement in the sample in order
-- Set filenames in loading steps to correct locations
-- (c) 2004, 2005 Microsoft Corp.
use
master
USE msdn2005
GO
--Create simple table containing XML column
IF EXISTS (SELECT * FROM sys.tables WHERE name = 'XMLdoc')
DROP TABLE XMLdoc
GO
CREATE
TABLE XMLdoc (id INT identity primary key, doc XML )
GO
-- Insert XML document
INSERT INTO XMLdoc (doc)
SELECT
*
FROM OPENROWSET (BULK 'insert your path here\Customer1.xml',
SINGLE_BLOB) AS TEMP
GO
-- Insert XML fragment
INSERT INTO XMLdoc (doc)
SELECT *
FROM OPENROWSET (BULK 'Insert your path here\Customer2.xml',
SINGLE_BLOB) AS TEMP
GO
-- Insert a string
INSERT INTO XMLdoc(doc) VALUES (N'<doc/>')
go
-- Take a look at the XML
SELECT * FROM XMLdoc
GO