• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 417
  • Last Modified:

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)
0
kingjely
Asked:
kingjely
1 Solution
 
kingjelyAuthor Commented:

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

will this replace the spaces in barcode1 field?  

0
 
rjdownCommented:
That'll remove any spaces from the beginning and end of the data in the barcode1 field, in every row in the supbarcode table.
0
 
kingjelyAuthor Commented:
Cool, Sweet,
It said
> zero rows effected,

which i assume means there wernt any?
0
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

 
Om PrakashCommented:
Yes
UPDATE `supbarcode` SET `barcode1` = trim( `barcode1` )
0
 
kingjelyAuthor Commented:

Hi sorry Om I had already answered!

0
 
KalpanCommented:
yes, that will work ...i also tried and TRIM function work

either you can use REPLACE(barcode1,'',' ')
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now