how to update values for following condition
CREATE TABLE T
(
C VARCHAR(10)
);
INSERT INTO T
VALUES ('0000'),
('123456789'),
('A'),
(''),
(' '),
(NULL);
I need to leave the NULL values or values which has 0000 as is and update the remaining to 1234.
expected output as below:
0000
1234
1234
1234
1234
NULL
I have tried with below statement but is there a better way to do this?
UPDATE T SET C=CASE WHEN C IS NULL then null
when C='0000' then '0000' else '1234' END