To be honest, I hope it IS a problem with my code, but I'm
just not seeing it. Here's the code:
<cffunction name="ImportProducts" returntype="void">
<cfset var OldInfo = "">
<cfset var StartRecID = 0>
<cfset var GetRecsCount = 1000>
<!--- Truncate the new table --->
<cfquery datasource="dsNew">
TRUNCATE TABLE products
</cfquery>
<!--- Load the old info --->
<cfquery name="OldInfo" datasource="dsOld"
maxrows="#GetRecsCount#">
SELECT
products.*,
products_description.products_description,
products_description.products_featured,
products_description.products_name,
products_description.products_viewed
FROM
products
LEFT JOIN products_description ON
(products.products_id = products_description.products_id)
WHERE
products.products_id > #StartRecID#
ORDER BY
products.products_id
</cfquery>
<cfloop condition="OldInfo.RecordCount GT 0">
<!--- Keep track of where we left off --->
<cfset StartRecID =
OldInfo.products_id[OldInfo.RecordCount]>
<!--- Insert the old info into the new db --->
<cfloop query="OldInfo">
<cfquery datasource="dsNew">
INSERT INTO products(
PROD_ID,
PROD_ModelNumber,
PROD_Name,
PROD_Description,
PROD_ImgURL,
PROD_NewInvQty,
PROD_AvailableAsOf,
PROD_Weight,
PROD_IsActive,
PROD_IsTaxable,
PROD_StatQtySold,
PROD_StatViewedCnt,
PROD_AddedOn,
PROD_AddedByAUSER_ID,
PROD_LastModifiedOn
)
VALUES (
#OldInfo.products_id#,
'#OldInfo.products_model#',
'#Replace(Replace(OldInfo.products_name, "\'", "'", "all"),
"\", "", "all")#',
'#Replace(Replace(OldInfo.products_description, "\'", "'",
"all"), "\", "", "all")#',
'#OldInfo.products_image#',
#OldInfo.products_quantity#,
<cfif Trim(OldInfo.products_date_available) NEQ "">
#CreateODBCDate(OldInfo.products_date_available)#,
<cfelse>
#CreateODBCDate(Now())#,
</cfif>
#OldInfo.products_weight#,
#OldInfo.products_status#,
#OldInfo.products_tax_class_id#,
#OldInfo.products_ordered#,
<cfif Trim(OldInfo.products_viewed) NEQ "">
#OldInfo.products_viewed#,
<cfelse>
0,
</cfif>
#CreateODBCDateTime(OldInfo.products_date_added)#,
1,
<cfif Trim(OldInfo.products_last_modified) NEQ "">
#CreateODBCDateTime(OldInfo.products_last_modified)#
<cfelse>
NULL
</cfif>
)
</cfquery>
</cfloop>
<!--- Load the old info --->
<cfquery name="OldInfo" datasource="dsOld"
maxrows="#GetRecsCount#">
SELECT
products.*,
products_description.products_description,
products_description.products_featured,
products_description.products_name,
products_description.products_viewed
FROM
products
LEFT JOIN products_description ON
(products.products_id = products_description.products_id)
WHERE
products.products_id > #StartRecID#
ORDER BY
products.products_id
</cfquery>
</cfloop>
</cffunction>