Let's see what Books Online says.DECLARE @DocHandle intDECLARE @XmlDocument nvarchar(1000)SET @XmlDocument = N'<ROOT><Customer CustomerID="VINET" ContactName="Paul Henriot"> <Order OrderID="10248" CustomerID="VINET" EmployeeID="5" OrderDate="1996-07-04T00:00:00"> <OrderDetail ProductID="11" Quantity="12"/> <OrderDetail ProductID="42" Quantity="10"/> </Order></Customer><Customer CustomerID="LILAS" ContactName="Carlos Gonzlez"> <Order OrderID="10283" CustomerID="LILAS" EmployeeID="3" OrderDate="1996-08-16T00:00:00"> <OrderDetail ProductID="72" Quantity="3"/> </Order></Customer></ROOT>'-- Create an internal representation of the XML document.EXEC sp_xml_preparedocument @DocHandle OUTPUT, @XmlDocument-- Execute a SELECT statement using OPENXML rowset provider.SELECT *FROM OPENXML (@DocHandle, '/ROOT/Customer',1) WITH (CustomerID varchar(10), ContactName varchar(20))EXEC sp_xml_removedocument @DocHandle
Peter LarssonHelsingborg, Sweden