In SQL Server, the semicolon is not needed. ----- Original Message ----- From: Bryan Stevenson <[EMAIL PROTECTED]> Date: Wednesday, February 27, 2002 3:23 pm Subject: Re: RE: Inserting a delimited list into a database
> and don't forget the semicolon after the SQL statement to seperate > the SQL for each iteration of the > loop ;-) > > Bryan Stevenson > VP & Director of E-Commerce Development > Electric Edge Systems Group Inc. > p. 250.920.8830 > e. [EMAIL PROTECTED] > --------------------------------------------------------- > Macromedia Associate Partner > www.macromedia.com > --------------------------------------------------------- > Vancouver Island ColdFusion Users Group > Founder & Director > www.cfug-vancouverisland.com > > ----- Original Message ----- > From: <[EMAIL PROTECTED]> > To: "CF-Talk" <[EMAIL PROTECTED]> > Sent: Wednesday, February 27, 2002 2:11 PM > Subject: Re: RE: Inserting a delimited list into a database > > > > In addition, if you want to reduce your database calls, you c an > alway> s > > > > do: > > > > <cfquery datasource="Software Updates" name="serverUp date"> > > > > <CFLOOP INDEX="ServerID" LIST="#servers#" DELIM ITER=" > > ,"> > > INSERT INTO [update] (log_id, server) > > VALUES (#logQuery.id#,#ServerID#) > > </CFLOOP> > > </cfquery> > > > > That way, you're only doing one db call, that has multiple statemen > > ts > > > > within it. > > > > Also, you should wrap the dynamic variables in the insert state ment > > > > with <cfqueryparam> tags. > > > > ----- Original Message ----- > > From: Matthew Walker <[EMAIL PROTECTED]> > > Date: Wednesday, February 27, 2002 3:07 pm > > Subject: RE: Inserting a delimited list into a database > > > > > Hey ho! The problem is having a table called Update! Try wrap ping > > > > > [] around > > > update. > > > > > > > > > -----Original Message----- > > > > From: Jake Munson [mailto:[EMAIL PROTECTED]] > > > > Sent: Thursday, 28 February 2002 10:47 am > > > > To: CF-Talk > > > > Subject: Inserting a delimited list into a database > > > > > > > > > > > > I have a form that returns a comma delimited list of > > > > numbers from some checkboxes that each have the same name . > > > > I want to be able to insert a new record in a database fo r > > > > each checkbox that was checked in my form. I figured t hat > > > > if I used a list loop based on my checkbox list, that I > > > > could have a SQL query insert a record for each value in > > > > the list. But it keeps giving me an error on the inser t > > > > query. Is it not possible to put a cfquery into a loop ? > > > > Is there a better way to do this? Below is my code. Below > > > > that is the error I get. > > > > > > > > <CFLOOP INDEX="ServerID" LIST="#servers#" DELIM > > ITER=","> > > > > <cfquery datasource="Software Updates" name=" serverUp > > date"> > > > > INSERT INTO update (log_id, server) > > > > VALUES (#logQuery.id#,#ServerID#) > > > > </cfquery> > > > > </CFLOOP> > > > > > > > > "[Microsoft][ODBC Microsoft Access Driver] Synt ax error > > in > > > > INSERT INTO statement. > > > > > > > > The error occurred while processing an element with a > > > > general identifier of (CFQUERY), occupying document > > > > position..." > > > > > > > > I thought that maybe the problem was that I didn't have a > > > > cfoutput around the #ServerID#, but that wasn't t he probl > > em > > > > either. > > > > > > > > Thanks for the help. > > > > > > > > -Jake > > > > > > > > ___________________ ___ > > ______________________ ___ > > ___ > > > > Do You Yahoo!? > > > > Yahoo! Greetings - Send FREE e-cards for every occasion! > > > > > > > > > _____________________ __ > > ______________________ ___ > > ______________________ > > > Why Share? > > > Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / > > > > > 20 GB MO/XFER > > > Instant Activation � $99/Month � Free Setup > > > http://www.pennyhost.com/redirect.cfm?adcode=col dfusionc > > > > > FAQ: http://www.thenetprofits.co.uk/coldfusion/faq > > > Archives: http://www.mail-archive.com/cf-talk@house offusion > > com/ > > > Unsubscribe: http://www.houseoffusion.com/index.cfm ?sideb > > ar=lists > > > > > > _______________________ _________________________ ______________________ > Dedicated Windows 2000 Server > PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER > Instant Activation � $99/Month � Free Setup > http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona > FAQ: http://www.thenetprofits.co.uk/coldfusion/faq > Archives: http://www.mail-archive.com/cf-talk@houseoffusion com/ > Unsubscribe: http://www.houseoffusion.com/index.cfm?sideb ar=lists > ______________________________________________________________________ Get Your Own Dedicated Windows 2000 Server PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER Instant Activation � $99/Month � Free Setup http://www.pennyhost.com/redirect.cfm?adcode=coldfusionb FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

