I would do it like this:
UPDATE YourTable SET B = COALESCE(B, A);
COALESCE is a function that returns its first nonzero argument.
In this example, if B in the given string is not null, the update is no-op.
If B is null, COALESCE skips it and uses A. instead.
Bill Karwin Oct 19 '11 at 5:53 on 2011-10-19 05:53
source share