SQL Server Performance

Combine two UPDATE statements

Discussion in 'Getting Started' started by lbgto, Jan 14, 2010.

  1. lbgto New Member

  2. moh_hassan20 New Member

    Where the text of the post ? [;)]
  3. FrankKalis Moderator

    [quote user="lbgto"]
    Welcome to the forum!
    The subject of your thread is not self-explanatory. We need some more information. [:)]
  4. Madhivanan Moderator

    If you have something like thisupdate table
    set col1='value1'
    where col2='test'
    set col1='value2'
    where col2<>'test'You can combine it
    update table
    set col1=case when col2='test' then 'value1' else 'value2' end

Share This Page