Hi People.... I have a table named 'csv_data_table' and it has a varchar(255) column named 'EMAIL'

This EMAIL column has multiple records with white spaces (at front and end)

I tried this way to eliminate the white space

UPDATE csv_data_table SET EMAIL = trim(EMAIL);

But it won't work.... the email values still have trailing blank spaces.

anyone know of a solution?

Recommended Answers

All 6 Replies

AFAIK it should work. How do you know that the email values still have spaces in them?

Sir, I saw it in phpmyadmin....... the records had spaces... one of the record I edited and removed the space via phpmyadmin itself...

so it was like 'abc@yahoo.com ' (note: quotes not present)

After editing in phpmyadmin I made it 'abc@yahoo.com'

Then I again created space at the end of the string in phpmyadmin.... So it was like 'abc@yahoo.com '

and then ran the query.... It did eliminate the space... making it 'abc@yahoo.com'

Now I'm kinda confused... was it blank space only.. well it did appeared like blank space... I even exported the ORIGINAL db file in sql format and opened it in notepadd++ searched for the email value and it was indeed 'abc@yahoo.com '

It did eliminate the space

Perhaps it was another non-visible character, that phpMyAdmin wasn't showing correctly.

Yes Sir, even I'm feeling that way.....

Thanx.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.