I want to update a column only if a condition is met. So for the column "Type", I want to change its value to "MongoDB" only if its current value isn't "MongoDB" This is what I'm using:
SET Type =
WHEN Type <> 'MongoDB' THEN 'MongoDB'
WHERE Id = x
(1 row(s) affected)
Why not simplify it like this?
UPDATE Report SET Type = 'MongoDB' WHERE Id = x AND Type <> 'MongoDB'
But to answer your question you are still setting a records value even though its to the existing value. The record also comes back in the where clause so you will always have 1 row affected regardless of your CASE statement.