Home > Enterprise >  update only the records inside brackets in sql
update only the records inside brackets in sql

Time:12-28

Below is my update script, i need to update only the message inside the brackets is that possible

currently the value of DESCRIPTION in table: "The document category (where the sales invoice is known) and the cash is used as the depreciation value for asset calculation."

I need to update as below:

UPDATE HES_SYSTEM_PARAMETERS
SET DESCRIPTION = 'The document category (where the sales invoice is not known) and the cash is used as the depreciation value for asset calculation.'
WHERE PARAMETER = 'CASH_OFF';

CodePudding user response:

A basic replacement should work here:

UPDATE HES_SYSTEM_PARAMETERS
SET DESCRIPTION = REPLACE(DESCRIPTION,
                          '(where the sales invoice is known)',
                          '(where the sales invoice is not known)')
WHERE PARAMETER = 'CASH_OFF' AND
      DESCRIPTION LIKE '%(where the sales invoice is known)%';
  • Related