[英]Can't get update statement in SQL Server to work
我正在嘗試執行此SQL Update語句,但它不起作用。 有人知道為什么嗎?
update dbo.EBSTable
set CommandField = replace(CommandField, '%APPL.mbm_aging_file', '%APPL.mbm_aging_file)')
where Command like '[%]APPL.mbm_aging_file'
基本上,我只是想在出現在CommandField
字段中的數據的末尾添加一個“)”,其中值是%APPL.mbm_aging_file
(“%”實際上出現在數據中)。
update dbo.EBSTable
set CommandField = '%APPL.mbm_aging_file' + ')' -- or set CommandField = '%APPL.mbm_aging_file)'
where Command = '%APPL.mbm_aging_file'
您可以執行此操作,因為僅在此特定情況下,只需在最后添加)
。
我發現我的where子句不合適(就像我使用SQL一樣)。 它應該讀
update dbo.EBSTable set CommandField = replace(CommandField, '%APPL.mbm_aging_file', '%APPL.mbm_aging_file)') where Command like '%[%]APPL.mbm_aging_file%'
該聲明奏效。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.