By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,479 Members | 1,021 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,479 IT Pros & Developers. It's quick & easy.

Removing spaces in MySQL data strings

P: 7
This is in relation to BANFA's succinct reply to my post the other day.

I have a bunch of phone numbers that contain one or two spaces and that I want to get consistent by removing them. However,

UPDATE berg SET phone="033" WHERE phone="033 ";

doesn't seem to remove them.

Any ideas?

Jul 21 '06 #1
Share this Question
Share on Google+
2 Replies

Expert Mod 5K+
P: 8,916

UPDATE berg SET phone=RTRIM(phone);

Back up your data first

Succinct message number 184 from a catalogue of 23658 succinct messages :D

P.S. You may want to check out the documentation at

for information on other string functions including LTRIM and TRIM.
Jul 21 '06 #2

Expert 2.5K+
P: 4,258
Are you sure your phone number field is defined as VARCHAR and not as CHAR?

Ronald :cool:
Jul 21 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.