簡體   English   中英

無法使SQL Server中的更新語句起作用

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM