List:General Discussion« Previous MessageNext Message »
From:Alex Schaft Date:February 15 2012 5:59am
Subject:Re: Batch update
View as plain text  
On 2/14/2012 10:30 AM, carsten@stripped wrote:
> On 14.02.2012 10:20, Alex Schaft wrote:
>
>> Hi,
>>
>> I need to update a table along the lines of the following
>>
>> update table set LastUpdate=now(), UpdateSource='Abc' Where Key1 = 'Def'
>> and Key2 = 'ghi'
>>
>> I need to possible do anywhere from 2 to 20 of these. Would it be better
>> to call an update statement for each of these,
>
> What exactly are "these"? Is 'Abc' constant for all rows, or does it 
> change for each Key1&Key2 value?
>
> If so, then simply
> WHERE (Key1=... AND Key2=...) OR (Key1=... AND Key2=...) OR... should 
> suffice
> or even:
> WHERE (Key1, Key2) IN (val1, val2),(val3,val4), ...
>
> If 'Abc' changes per Key1&Key2 values, explore the CASE statement.
>
> Best,
>
> / Carsten
>
Hi,

'Abc' would stay the same, as well as 'Def', but 'ghi' will change. I'll 
look into the where with the in operator, thanks.

Thread
Batch updateAlex Schaft14 Feb
  • Re: Batch updatecarsten14 Feb
    • Re: Batch updateAlex Schaft15 Feb