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"]
    [/quote]
    Welcome to the forum!
    The subject of your thread is not self-explanatory. We need some more information. [:)]
  4. Madhivanan Moderator

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

Share This Page