[Koha] BULK EDIT BARCODES

muirunyeri muirunyeri at gmail.com
Wed Aug 12 03:11:51 NZST 2020


Hello,
On the above subject earlier, I wrote 
Ians suggestion solved my case.
It sure did once but am still stuck at one point where the query finds matches but changes none with no warnings. The hyphen is just one character I'm trying to change among others. I believe the query is similar.
Why aren't the changes effecting or what am I missing?
My query:
UPDATE items SET barcode = REPLACE(barcode, '--', '-') WHERE barcode LIKE '%--%';
RESULTS: Rows matched 1290: changed 0: Warnings 0
Please assist
RegardsJames

Sent from my Samsung Galaxy smartphone.-------- Original message --------From: Ian Bays <ian.bays at ptfs-europe.com> Date: 29/07/2020  23:43  (GMT+03:00) To: koha at lists.katipo.co.nz Subject: Re: [Koha] BULK EDIT BARCODES 
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 at lists.katipo.co.nz
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
>
>

_______________________________________________

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


More information about the Koha mailing list