sql - update only when values are different

Posted by BhejaFry on Stack Overflow See other posts from Stack Overflow or by BhejaFry
Published on 2010-05-04T15:12:25Z Indexed on 2010/05/04 15:28 UTC
Read the original article Hit count: 475

Filed under:
|
|

Hi folks,

In SQL Server 2008, how do i update fields in a table only if their values differ with the values in the update statement ?

For ex:

I have TableA with column FirstName whose value is 'Roger Moore' with an unique id of '007'. Now, i am calling an update statement but it should update the 'FirstName' field only if value is something else other than 'Roger Moore'.

TIA

© Stack Overflow or respective owner

Related posts about sql

Related posts about update