SQL Server Performance

update optimized

Discussion in 'T-SQL Performance Tuning for Developers' started by zanglieft, Apr 18, 2010.

  1. zanglieft New Member

    I want to ask about solving my problem.I have depositors table with the following fields
    the question is how to update the right so that the update process only once ..
    I am doing is thisdepositors
    update set owner = 'Januar' account = 'b' saldo_original = 5000 kurs = 9500 Interest = 0.5
    update depositors set balance = kurs * saldo_original
    update depositors set amount = balance * interest
    update depositors set description = (case amount> 10,000,000 then 'Top depositors' else 'normal depositors') end
    I want to fix the problem and update process is not only a 1 times not 4 times as above, i am trying to make one update but the results not successful.So .. how to optimized ..thanks before ..
  2. satya Moderator

    Welcome to the forums.
    Actually you have 4 fields to update, so it will be better if you perform this in a transactional mode BEGIN...END that will have data consistency. That will also help in optimization of code rather than you running a TSQL against a big chunk of rows.

Share This Page