Yes it would, but if it didn't meet the criteria then it would just leave the 
value as is. The person asking the question stated that this was for a school, 
that would probably be a few thousand students at most.

Plus I gave the alternative of a table join which would be more restrictive.

Steve



-----Original Message-----
From: Byron Mann [mailto:[email protected]] 
Sent: Thursday, February 06, 2014 11:24 PM
To: sql
Subject: Re: sql query help


Need to update that, the Case statement would update every row where gom =
'maze'. Even those rows not needing to be updated.

Byron Mann
Lead Engineer & Architect
HostMySite.com
On Feb 6, 2014 11:17 PM, "Byron Mann" <[email protected]> wrote:

> Depending on your table size, indexing and number of rows actually being
> updated, it may be better to just wrap all the updates into a transaction.
>
> BEGIN TRAN;
>
> UPDATE......
> UPDATE......
> UPDATE......
> ....
> COMMIT TRAN;
>
> The case statement example may not be optimal, as it will update every row
> unnecessarily. Not nice if you have a million row table and only need to
> actually update 30 rows.
>
> Multiple OR statements is probably better, as you will be restricting the
> update to the required rows, but might be hard to read for debugging. Plus
> too many ORs and performance may be more optimal with multiple updates.
>
> I usually find the simple the better.
>
> Byron Mann
> Lead Engineer & Architect
> HostMySite.com
>




~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: http://www.houseoffusion.com/groups/sql/message.cfm/messageid:3541
Subscription: http://www.houseoffusion.com/groups/sql/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/sql/unsubscribe.cfm

Reply via email to