0
我想更新列中包含複雜條目並且只是列中的一個子句而不影響其他值的表。帶有VARCHAR的UPDATE列(2)4000字節值
想要更新#Rule number=0#
到#Rule number=1#
但不影響列中的其他值。這可能嗎?
我想更新列中包含複雜條目並且只是列中的一個子句而不影響其他值的表。帶有VARCHAR的UPDATE列(2)4000字節值
想要更新#Rule number=0#
到#Rule number=1#
但不影響列中的其他值。這可能嗎?
您是否在尋找replace()
?如果dynamic_attributes
是一個字符串:
update t
set dynamic_attributes = replace(dynamic_attributes,
'#Rule number=0#',
'#Rule number=1#'
)
where dynamic_attributes like '%#Rule number=0#%';
注:字符串可能不存儲這樣的列表的最佳方式。你應該考慮一個表格,每行customer_id
和動態屬性。
這就是:
UPDATE A
SET A.dynamic_attributes = REPLACE(A.dynamic_attributes,'#Rule number=0#','#Rule number=1#')
FROM yourtable AS A
WHERE A.dynamic_attributes LIKE '%#Rule number=0#%'