Search code examples
postgresqlnullsql-updatealter

Updating integer column with null values in postgres


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"


Solution

  • This should be,

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