ok I did this

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<cfset mylist="Advertising,tools">
<cfloop list="#mylist#" index="listItem">
  <cfquery datasource="classifieds">
    INSERT INTO sub_categories (sub_category,cat_id )
    VALUES (<cfqueryparam value="#myList#">,<cfqueryparam
value="#listItem#">)
  </cfquery>
</cfloop>

and I got this

ODBC Error Code = 22005 (Error in assignment)


[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting the
varchar value 'Advertising' to a column of data type int.



The sub_category field is a data type of varchar, not sure why it wants to
convert it in the first place.





----- Original Message -----
From: "Jochem van Dieten" <[EMAIL PROTECTED]>
To: "CF-Talk" <cf-talk@houseoffusion.com>
Sent: Saturday, August 05, 2006 9:14 AM
Subject: Re: problem with insert


> Doug wrote:
> >
> > I have two tables
> >
> > categories:     (This table is populated with the categories already)
> > [id] pri key
> > category
> >
> > sub_categories     (This table is empty)
> > [id] pri key
> > cat_id FK to categories.id
> > sub_category
> >
> > I want to insert a comma delimeted list into the sub_categories table.
>
> <cfloop list="#myList#" index="listItem">
>   <cfquery ...>
>     INSERT INTO sub_categories (cat_id, sub_category)
>     VALUES (
>       <cfqueryparam value="#something#">,
>       <cfqueryparam value="#listItem#">
>       )
>   </cfquery>
> </cfloop>
>
> Jochem
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

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

Reply via email to