MySQL如何去掉垃圾或腐败的字符?

时间:2015-10-13 14:12:58

标签: mysql validation etl corrupt-data

MySQL 5.6

第1-3行似乎有一些垃圾字符。第4行是很好的数据。

select id, firstname, length(firstname) len,
substring(firstname,1,1) ss1, ascii(substring(firstname,1,1)) a1,
substring(firstname,2,1) ss2, ascii(substring(firstname,2,1)) a2,
substring(firstname,3,1) ss3, ascii(substring(firstname,3,1)) a3,
substring(firstname,4,1) ss4, ascii(substring(firstname,4,1)) a4,
substring(firstname,5,1) ss5, ascii(substring(firstname,5,1)) a5,
substring(firstname,6,1) ss6, ascii(substring(firstname,6,1)) a6,
substring(firstname,7,1) ss7, ascii(substring(firstname,7,1)) a7,
substring(firstname,8,1) ss8, ascii(substring(firstname,8,1)) a8,
substring(firstname,9,1) ss9, ascii(substring(firstname,9,1)) a9
from users
where id in (91788, 91844, 79631, 5351791)
order by id

结果:

enter image description here

奇怪的字符在ETL过程中导致问题。如何去除垃圾字符?

PS注意第2行表示长度为5,但只有前3个字符具有ascii值。这是正常的吗?

0 个答案:

没有答案