Mysql TRIM not working

I am trying to clear my numbers in my database using:

update valuations set Telephone = TRIM(Telephone) where  1 = 1

but 0 lines are executed, and all nnmmbers still have a place in them. The data type is varchar, so I'm not sure why this is not working - can anyone help?

thank

+4
source share
4 answers

Hi pandemic please use

Evaluations UPDATE SET Phone = REPLACE (Phone, ``, '') WHERE 1 = 1;

Hope this works.

+2
source

As I said in my comment, I assume that your spaces in the middle of your posts TRIMwill not work. Use REPLACE instead :

UPDATE valuations SET Telephone = REPLACE(Telephone, ' ', '') WHERE 1 = 1;
+6
source

trim() . , replace:

UPDATE valuations SET Telephone = REPLACE(Telephone, ' ', '') where  1 = 1
+2

First you have to trim the line and after that replace the space with a blank character:

update valuations set Telephone = REPLACE(TRIM(Telephone), ' ', '') where  1 = 1
Function

TRIM Useful when you need to remove other empty characters from the beginning and end of a line, such as a new line character or TAB.

More details about the function TRIM(): http://dev.mysql.com/doc/refman/5.7/en/string-functions.html#function_trim

+1
source

Source: https://habr.com/ru/post/1652430/


All Articles