Hi.

I think you do not need the % characters in the REPLACE patterns.  You could use something like:

UPDATE items SET barcode = REPLACE(barcode, '--', '-') WHERE barcode LIKE 
'%--%';


assuming you want to change all barcodes with "--".

Hope this helps.

On 29/07/2020 20:45, muiru james wrote:
Hi Team,

I need to edit barcodes to replace a double hyphen (--) with a single
hyphen (-). The barcodes are many and will take long using the item editor
which allows me to edit one after the other.

Is there a SQL command I could use to edit from the terminal? I tried
running the query below. It is matching the records but changing none. Is
there something I am missing?

MariaDB[koha_library]>
UPDATE items SET barcode = REPLACE(barcode, '%--%', '%-%') WHERE itemnumber
IN (377,378,391,.....);

I am using koha version 19.11 on Ubuntu 16.04 and mysql Ver 15.1 Distrib
10.0.38-MariaDB

Please assist

Warm Regards
James
_______________________________________________

Koha mailing list  http://koha-community.org
Koha@lists.katipo.co.nz
Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha



_______________________________________________

Koha mailing list  http://koha-community.org
Koha@lists.katipo.co.nz
Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha

Reply via email to