我正在尝试更新表中的注释以存档某些文件。我已经生成了SQL脚本并且因为笔记中有Null值的帐户而出现问题。我希望我的笔记更新在当前笔记字段中是否有Note或Null。下面是我的SQL语句:
update dbo.CaseTable
set Quick = 'Case files have been archived. To have file access restored, please enter a helpdesk ticket with the full case name. '
+ convert(varchar(255),Quick)
where CaseID = 1
答案 0 :(得分:2)
试试这个:
update dbo.CaseTable
set Quick = 'Case files have been archived. To have file access restored, please enter a helpdesk ticket with the full case name. '
+ convert(varchar(255), ISNULL(Quick, ''))
where CaseID = 1
答案 1 :(得分:1)
您可以使用 CONCAT 功能。空值隐式转换为空字符串。
试试这个:
update dbo.CaseTable
set Quick = CONCAT('Case files have been archived. To have file access restored, please enter a helpdesk ticket with the full case name. ' , CAST(Quick AS varchar(255)))
where CaseID = 1
答案 2 :(得分:0)
更新dbo.Case表 设置quick ='案例文件已存档。 要恢复文件访问权限,请输入 带有全名的服务台票。' +转换(VARCHAR(255),ISNULL(快速“)) caseID = 1
的地方