
USE [AdventureWorks]
go


-- Load XML from a file
DECLARE @x XML
SET @x = (
SELECT * FROM OPENROWSET(
   BULK 'C:\SQLskills\Session2\XMLDataType\invoice.xsd',
           SINGLE_BLOB
) AS x
)

-- And use it to create an XML schema collection
CREATE XML SCHEMA COLLECTION InvoiceType AS @x
go

-- XML SCHEMA COLLECTION CREATED

CREATE TABLE invoice_docs (
 invoiceid INTEGER PRIMARY KEY IDENTITY,
 invoice   XML(document InvoiceType)
)
go



