Listing 3: OpenXML Example That Inserts a Row into a Table from an XML Document DECLARE @h int DECLARE @xmldoc varchar(1000) set @xmldoc = ' ' EXEC sp_xml_preparedocument @h OUTPUT, @xmldoc /* insert into table. Note the single XPath */ /* mapping and document name in the WITH clause */ INSERT INTO authors SELECT * FROM OpenXML(@h,'/root/authors') WITH authors EXEC sp_xml_removedocument @h