postgresql 在postgres中用空值更新整数列
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/46802623/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 06:27:51 来源:igfitidea点击:
Updating integer column with null values in postgres
提问by no_name
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)
我想用其他表中的其他列更新我的列。在这样做之前,我想先取消我的列(整数)。但是,下面的代码不起作用。(column_a:bigint;column_b:文本)
UPDATE table1
SET column_a IS NULL
WHERE column_b = 'XXX';
ERROR: syntax error at or near "ISNULL"
错误:“ISNULL”处或附近的语法错误
回答by shiv
This should be,
这应该是,
UPDATE table1
SET column_a = NULL
WHERE column_b = 'XXX';