Link to home
Start Free TrialLog in
Avatar of kingjely
kingjelyFlag for Australia

asked on

mysql update table Trim barcode field so it has no leading or trailing spaces


Hi guys,
Can anyone see what i have done worng in my syntax to
alter this table and trim the spaces off barcode1 field?

update table supbarcode set barcode1 = trim(barcode1)
Avatar of kingjely
kingjely
Flag of Australia image

ASKER


Is this it?
update supbarcode set barcode1 = trim(barcode1)

will this replace the spaces in barcode1 field?  

ASKER CERTIFIED SOLUTION
Avatar of rjdown
rjdown
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Cool, Sweet,
It said
> zero rows effected,

which i assume means there wernt any?
Yes
UPDATE `supbarcode` SET `barcode1` = trim( `barcode1` )

Hi sorry Om I had already answered!

Avatar of Kalpan
yes, that will work ...i also tried and TRIM function work

either you can use REPLACE(barcode1,'',' ')