<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: SQL Bulk Load with ColdFusion &#8211; SQLXMLBulkLoad.SQLXMLBulkLoad</title>
	<atom:link href="http://www.fusionteam.co.uk/blog/2008/01/16/sql-bulk-load-with-coldfusion-sqlxmlbulkloadsqlxmlbulkload/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.fusionteam.co.uk/blog/2008/01/16/sql-bulk-load-with-coldfusion-sqlxmlbulkloadsqlxmlbulkload/</link>
	<description>ColdFusion, Adobe, Flex, RIA, Silverlight, Flash and all things web!</description>
	<lastBuildDate>Mon, 16 Aug 2010 14:49:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Roman Smolkin</title>
		<link>http://www.fusionteam.co.uk/blog/2008/01/16/sql-bulk-load-with-coldfusion-sqlxmlbulkloadsqlxmlbulkload/comment-page-1/#comment-153</link>
		<dc:creator>Roman Smolkin</dc:creator>
		<pubDate>Fri, 03 Apr 2009 20:30:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.fusionteam.co.uk/blog/2008/01/16/sql-bulk-load-with-coldfusion-sqlxmlbulkloadsqlxmlbulkload/#comment-153</guid>
		<description>Do you know if it&#039;s possible to use it if ColdFusion and MS SQL are on different servers?  I can save the XML file locally on the ColdFusion server, but not on SQL Server, will that work?

Also, for the connectionstring, can a connection somehow be passed in from the coldfusion admin?

We have to move about 10000 records from Oracle DB into MS SQL (nightly).  Our Oracle guys wrote a web service that we can access through ColdFusion and it sends back an XML file.  That part works really fast (seconds).  The file is about 4MB.  The ColdFusion then feeds the file to a SQL Server Stored Procedure (I&#039;ll put code below) which is pretty simple and works great on small record sets.  I&#039;ve loaded 500 records with it easily.  But if we try the full 10k, the SQL Server CPU goes to 100% and never stops.  And that&#039;s a powerful server with 4GB of memory.
 
We&#039;ve even eliminated the first step and just had the file read by coldfusion from disk and passed to MS SQL.  The thing is we can&#039;t save it locally to the SQL Server (I guess for security reasons).
 
So after much searching now I&#039;m trying to figure out if it&#039;s possible to get ColdFusion to work with the SQLXMLBulkLoad object.
 
Below is the CF and Stored Procedure code (some parts are commented out as we&#039;ve been experimenting with pieces of it.
 
Thanks for any help,
-Roman
 
============
MS SQL PART
 
ALTER PROCEDURE [dbo].[sp_insertOracleFacs] (@xml XML)
 
AS
BEGIN
    DELETE FROM temp_Oracle_Facility_Info
    INSERT INTO temp_Oracle_Facility_Info (
                facility_id,
                company_nm,
                section_id,
                section_nm,
                addr1,
    addr2,
    addr3,
    addr4,
                city,
                [state],
                postal)
    SELECT
        doc.col.value(&#039;facility_id[1]&#039;, &#039;varchar(10)&#039;),
        doc.col.value(&#039;company_nm[1]&#039;, &#039;varchar(200)&#039;),
        doc.col.value(&#039;section_id[1]&#039;, &#039;varchar(3)&#039;),
        doc.col.value(&#039;section_nm[1]&#039;, &#039;varchar(100)&#039;),
        doc.col.value(&#039;addr1[1]&#039;, &#039;varchar(100)&#039;),
  doc.col.value(&#039;addr2[1]&#039;, &#039;varchar(100)&#039;),
  doc.col.value(&#039;addr3[1]&#039;, &#039;varchar(100)&#039;),
  doc.col.value(&#039;addr4[1]&#039;, &#039;varchar(100)&#039;),
  doc.col.value(&#039;city[1]&#039;, &#039;varchar(100)&#039;),
  doc.col.value(&#039;state[1]&#039;, &#039;varchar(3)&#039;),
  doc.col.value(&#039;postal[1]&#039;, &#039;varchar(5)&#039;)
    FROM @xml.nodes(&#039;//FacilityInfo&#039;) AS doc(col)
END
 
===========
COLDFUSION PART
 
 &lt;!--- Make HTTP Request ---&gt;
    &lt;!---Send HTTP Request--&gt;
      ---&gt;
   &lt;!---  ---&gt;
   
    &lt;!--- Create the XML Object ---&gt;
    &lt;!--- Create XML--&gt;
     ---&gt;
   
   &lt;!--- Done writing file  ---&gt;
   
   Done Reading File
   
   &lt;!---  ---&gt;
   
    &lt;!--- Run Stored Procedure--&gt;
    
        
     ---&gt;</description>
		<content:encoded><![CDATA[<p>Do you know if it&#8217;s possible to use it if ColdFusion and MS SQL are on different servers?  I can save the XML file locally on the ColdFusion server, but not on SQL Server, will that work?</p>
<p>Also, for the connectionstring, can a connection somehow be passed in from the coldfusion admin?</p>
<p>We have to move about 10000 records from Oracle DB into MS SQL (nightly).  Our Oracle guys wrote a web service that we can access through ColdFusion and it sends back an XML file.  That part works really fast (seconds).  The file is about 4MB.  The ColdFusion then feeds the file to a SQL Server Stored Procedure (I&#8217;ll put code below) which is pretty simple and works great on small record sets.  I&#8217;ve loaded 500 records with it easily.  But if we try the full 10k, the SQL Server CPU goes to 100% and never stops.  And that&#8217;s a powerful server with 4GB of memory.</p>
<p>We&#8217;ve even eliminated the first step and just had the file read by coldfusion from disk and passed to MS SQL.  The thing is we can&#8217;t save it locally to the SQL Server (I guess for security reasons).</p>
<p>So after much searching now I&#8217;m trying to figure out if it&#8217;s possible to get ColdFusion to work with the SQLXMLBulkLoad object.</p>
<p>Below is the CF and Stored Procedure code (some parts are commented out as we&#8217;ve been experimenting with pieces of it.</p>
<p>Thanks for any help,<br />
-Roman</p>
<p>============<br />
MS SQL PART</p>
<p>ALTER PROCEDURE [dbo].[sp_insertOracleFacs] (@xml XML)</p>
<p>AS<br />
BEGIN<br />
    DELETE FROM temp_Oracle_Facility_Info<br />
    INSERT INTO temp_Oracle_Facility_Info (<br />
                facility_id,<br />
                company_nm,<br />
                section_id,<br />
                section_nm,<br />
                addr1,<br />
    addr2,<br />
    addr3,<br />
    addr4,<br />
                city,<br />
                [state],<br />
                postal)<br />
    SELECT<br />
        doc.col.value(&#8216;facility_id[1]&#8216;, &#8216;varchar(10)&#8217;),<br />
        doc.col.value(&#8216;company_nm[1]&#8216;, &#8216;varchar(200)&#8217;),<br />
        doc.col.value(&#8216;section_id[1]&#8216;, &#8216;varchar(3)&#8217;),<br />
        doc.col.value(&#8216;section_nm[1]&#8216;, &#8216;varchar(100)&#8217;),<br />
        doc.col.value(&#8216;addr1[1]&#8216;, &#8216;varchar(100)&#8217;),<br />
  doc.col.value(&#8216;addr2[1]&#8216;, &#8216;varchar(100)&#8217;),<br />
  doc.col.value(&#8216;addr3[1]&#8216;, &#8216;varchar(100)&#8217;),<br />
  doc.col.value(&#8216;addr4[1]&#8216;, &#8216;varchar(100)&#8217;),<br />
  doc.col.value(&#8216;city[1]&#8216;, &#8216;varchar(100)&#8217;),<br />
  doc.col.value(&#8216;state[1]&#8216;, &#8216;varchar(3)&#8217;),<br />
  doc.col.value(&#8216;postal[1]&#8216;, &#8216;varchar(5)&#8217;)<br />
    FROM @xml.nodes(&#8216;//FacilityInfo&#8217;) AS doc(col)<br />
END</p>
<p>===========<br />
COLDFUSION PART</p>
<p> <!--- Make HTTP Request ---><br />
    <!---Send HTTP Request--><br />
      &#8212;&gt;<br />
   <!---  ---></p>
<p>    <!--- Create the XML Object ---><br />
    <!--- Create XML--><br />
     &#8212;&gt;</p>
<p>   <!--- Done writing file  ---></p>
<p>   Done Reading File</p>
<p>   <!---  ---></p>
<p>    <!--- Run Stored Procedure--></p>
<p>     &#8212;&gt;</p>
]]></content:encoded>
	</item>
</channel>
</rss>
