如何解决无法在SQL Server 2017年的列错误中插入NULL值
这是我的查询
insert into membre (code)
select code = case when trig = '' then 'toto' else case when trig is null 'titi' end end
from test
我想将此结果插入表测试,但会打印此错误 。你能帮我吗?
解决方法
我怀疑您想要以下逻辑
insert into membre(code)
select case
when trig = '' then 'toto'
when trig is null then 'titi'
else trig
end
from test
这会将test(trig)
插入membre(code)
,同时将空字符串转换为'toto'
,并将null
值转换为'titi'
。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。