Posted Thu, 12 Sep 2019 02:01:02 GMT by

I have an XML file with about 11,000 elements and each element has about 50 attributes which I need to read and convert into a SQL INSERT statement.  I have it working but reading each element and then each attribute (11,000 X 50) creates about 550,000 AMXML ACTIVITY="read_node" events which is  EXTREMELY slow.

I'm currently looking through the list of 50 attributes (stored in an array) then reading each attribute into a variable which is then concatenated to create a SQL INSERT statement. Can I read multiple XML attributes into a dataset instead of reading them one at a time into a variable?

 <AMXML ACTIVITY="read_node" SESSION="XML-READ" XPATH="/Report//ReportItem[%ITEM%]" ATTRNAME="%ATTR%" RESULTVARIABLE="VALUE" />

 

 

Posted Fri, 13 Sep 2019 01:37:47 GMT by

Hello Dan,

Unfortunately the only other option is "node to dataset". However this is also on a per node basis.

If you have a powershell or basic script that accomplishes your goal faster, you may want to use the action for powershell or basic scripts, respectively, to spend less time on processing.

Posted Mon, 16 Sep 2019 20:25:21 GMT by

Have you considered using XML in the SQL insert? 

Example: http://techfunda.com/howto/205/insert-records-from-xml-to-sql-server-database-table

Posted Mon, 16 Sep 2019 20:44:02 GMT by

I will look into using XML directly in the SQL statement. Thank you.

You must be signed in to post in this forum.