Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
フィールド内のテキストを置き換えたいので、次のステートメントがあります。
UPDATE INVENTORY SET INV_DESCRIPTION = REPLACE(INV_DESCRIPTION, '5 ml', '5ml (1/6oz)')
問題は、このステートメントが '5 ml' '15 ml' '150 ml' などの文字列を置換文字列に置き換えるという事実にあります。この関数が単語全体に一致し、「5 ml」を探すだけであることを望みます
WHEREかなり近いものにする句を追加できます。
WHERE
...Your Current Query... WHERE INV_DESCRIPTION LIKE '5ml%' OR INV_DESCRIPTION LIKE '% 5ml%'
で始まる5mlか、その前にスペースがあるレコードのみを更新し、 orなど5mlを除外します.15ml25ml
5ml
15ml
25ml
これは SQL Server を想定しています。