有没有办法将表的所有列的所有 0 替换为 null?我知道如何为单列执行此操作,我正在为所有列搜索类似动态查询的内容。
这回答了问题的原始版本。
您可以编写一个 update 查询,但您需要列出所有列:
update
update t set col1 = nullif(col1,0),col2 = nullif(col2,. . . ;
您可能想要添加:
where col1 = 0 or col2 = 0 or . . .
限制处理的行数。