You are setting the column Shirt in the table Team for all records.

You need a where clause to update the individual records.

Do you have a primary key set, like an id column or something. 


Chuck Weidler
Lockheed Martin Information Technology
7152 Windsor Blvd
Baltimore, MD  21244
Voice:  (443) 348-4252
Email:  [EMAIL PROTECTED]

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: Friday, March 28, 2008 6:17 AM
To: CF-Newbie
Subject: Looping an update query

Hi,

This seems like it should be pretty straightforward but I'm new to
ColdFusion and cannot get this at all.

I want to update a column in a database with an incremented variable in
a loop. I want to be able to do this for a date column eventually
(increment to next
day) but
I cannot get even this basic query below to work.

The query is :

<cfset playerShirt = 1>

<cfloop condition = "playerShirt LTE 10">
        <cfquery name = "UpdateTeam" datasource = "#dsn#">
                Update Team
                set Shirt =  #playerShirt#
                <cfset playerShirt = playerShirt + 1>
        </cfquery>
</cfloop>

What I want this to do is loop through the Team table starting at row 1
and update the players shirt number from 1 to 10.

At the moment all shirt numbers are set to 10.

Any guidance on this would be greatly appreciated.

thanks in advance

aor




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;192386516;25150098;k

Archive: 
http://www.houseoffusion.com/groups/CF-Newbie/message.cfm/messageid:3504
Subscription: http://www.houseoffusion.com/groups/CF-Newbie/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.15

Reply via email to