Thanks. I didn't know about Limit... VERY handy (and it eliminated some 
duplicate code I had. Did I mention this was a rush project?) Thanks 
again. :)

Barney Boisvert wrote:
> I'm pretty sure that MSSQL supports a TOP clause for limiting an
> UPDATE statement, just like for SELECT.  I know that MySQL's LIMIT
> clause can be used for UPDATE.
> 
> cheers,
> barneyb
> 
> On Mon, Sep 29, 2008 at 11:24 AM, Charlie Griefer
> <[EMAIL PROTECTED]> wrote:
>> assuming there's some sort of unique identifier.... you could put a subquery
>> in the WHERE
>> UPDATE
>>    Werewolf_Players
>> SET
>>     foo = bar
>> WHERE
>>     uniqueCol = (SELECT TOP 1 uniqueCol FROM Werewolf_Players WHERE
>> uniqueCol = newID())
>>
>> i think that'd work... and i think that's MS SQL Server specific syntax.
>>
>> On Mon, Sep 29, 2008 at 11:16 AM, Phillip M. Vector <
>> [EMAIL PROTECTED]> wrote:
>>
>>> Is there a simple way of only updating one record?
>>>
>>> <cfquery datasource="#SiteDatasource#" maxrows="1">
>>>        update Werewolf_Players
>>>        set Role = 2
>>>        where Role = 0
>>>        and gameid = #check.GameID#
>>>        order by Rand()
>>> </cfquery>
>>>
>>> I thought the maxrows would work, but apparently not.
>>>
>>> Any ideas without me having to build an array or anything to complicated
>>> (I'm trying to toss this up in a day or so, so I don't have time to get
>>> super complicated).
>>>
>>> Is there any way of updating just 1 record randomly when all the record
>>> fields are the same?
>>>
>>>
>>
> 
> 

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

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:313231
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