Updating integer column with null values in postgres

PostgresqlNullSql UpdateAlter

Postgresql Problem Overview


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"

Postgresql Solutions


Solution 1 - Postgresql

This should be,

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
Questionno_nameView Question on Stackoverflow
Solution 1 - PostgresqlshivView Answer on Stackoverflow