Xenon, thanks for the suggestion, but what I need to know is how to read XML from a file.
I'm not sure how I could accomplish what I'm after with DTS as I've got XML files being emailed in, and I'm intending to use xp_readMail etc to collect them. They have xml attachments which I want to parse and store some of the data in the file.
Is it possible to start a DTS package from a stored procedure?
Is it possible to then have a file data source connection in that DTS package dynamically set the path to the path of the attachment.
Thanks,
Dawson
Main Topics
Browse All Topics





by: xenon_jePosted on 2003-07-07 at 01:28:59ID: 8867656
redad in BOl about openXML
0:00"> 0:00">
Here is the sample from BOL:
DECLARE @idoc int
DECLARE @doc varchar(1000)
SET @doc ='
<ROOT>
<Customer CustomerID="VINET" ContactName="Paul Henriot">
<Order CustomerID="VINET" EmployeeID="5" OrderDate="1996-07-04T00:0
<OrderDetail OrderID="10248" ProductID="11" Quantity="12"/>
<OrderDetail OrderID="10248" ProductID="42" Quantity="10"/>
</Order>
</Customer>
<Customer CustomerID="LILAS" ContactName="Carlos Gonzlez">
<Order CustomerID="LILAS" EmployeeID="3" OrderDate="1996-08-16T00:0
<OrderDetail OrderID="10283" ProductID="72" Quantity="3"/>
</Order>
</Customer>
</ROOT>'
--Create an internal representation of the XML document.
EXEC sp_xml_preparedocument @idoc OUTPUT, @doc
-- Execute a SELECT statement that uses the OPENXML rowset provider.
SELECT *
FROM OPENXML (@idoc, '/ROOT/Customer',1)
WITH (CustomerID varchar(10),
ContactName varchar(20))
The content of the xml file can be imported in a table column by simply using DTS....
good luck,
xenon