You want to evaluate field to its value

>                if (isNumeric(field)) {
>                        field = trim(evaluate(field));
>                } else {
>                        field = "'" & trim(evaluate(field)) & "'";
>                }
>                return field;

Mik


At 09:21 AM 3/19/2007, Pete Ruckelshaus wrote:
>Hi All,
>
>I have a data import project that I am trying to simplify, mainly
>because of the number of tables and amount of data involved.  I'm
>importing a number of tables from a MySQL database to an MS SQL Server
>database with an identical structure, except for datatypes being
>changed where appropriate.
>
>The problem is, in my code I am ending up passing in the column name
>rather than the actual column value.  Can anyone tell me what I'm
>doing wrong?  Here's my code:
>
>
><cfscript>
>        function sqlValueFormat(field) {
>                if (isNumeric(field)) {
>                        field = trim(field);
>                } else {
>                        field = "'" & trim(field) & "'";
>                }
>                return field;
>        }
></cfscript>
><cfset table_list = "table1, table2, table3, table4, table5, table6">
><cfloop index="I" list="#table_list#" delimiters=",">
>        <cfquery name="getall" datasource="db_mysql">
>                SELECT          *
>                FROM            #trim(i)#
>        </cfquery>
>        <cfquery name="insertAll" datasource="db_mssql">
>                <cfloop query="getall">
>                        INSERT INTO             #trim(i)#(#getall.columnlist#)
>                        VALUES                  (<cfloop 
> list="#getall.columnlist#" index="j"
>delimiters=",">#sqlValueFormat(evaluate(j))#<cfif NOT
>listLast(getall.columnlist, ",")>,</cfif></cfloop>);
>                </cfloop>
>        </cfquery>
></cfloop>
>
>
>The error that I'm getting is "cannot convert the value "STAMP" to a
>boolean" -- "STAMP" is a column name in the table, not the actual
>chunk of data, which is what I want.
>
>Thanks!
>
>Pete
>
>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 & 
Flex 2
Free Trial 
http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:272991
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to