Updating integer column with null values in postgres

no_name picture no_name · Oct 18, 2017 · Viewed 61.8k times · Source

I would like to update my column with other column in other table. Before doing so, I would like to nullify my column(integer) first. However, below code did not work. (column_a: bigint; column_b: text)

UPDATE table1
SET column_a IS NULL
WHERE column_b = 'XXX';

ERROR: syntax error at or near "ISNULL"

Answer

shiv picture shiv · Oct 18, 2017

This should be,

UPDATE table1 
SET column_a = NULL
WHERE column_b = 'XXX';