如何检查MySQL数据库中表中的行是否包含多字节字符?
我有一个表,其中包含存储字符串值的 descr
列。 descr
中的某些值包含多字节字符,我想知道所有这些行,以便删除这些字符。如何使用 MySQL 函数查询表以确定哪些行具有多字节字符。我使用的是 MySQL 5.1 版本
I have a table which has column of descr
which stores string values. Some of the values in descr
has multi-byte characters in it and I want to know all those rows so I can remove those characters. How can I query the tables using MySQL functions to determine which rows have multi-byte characters. I am using MySQL version 5.1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
char_length 是多字节感知的并返回实际的字符数。 Length() 是纯字节计数,因此 3 字节字符返回 3。
char_length is multi-byte aware and returns the actual character count. Length() is a pure byte-count, so a 3-byte char returns 3.
您是否在 descr 列上尝试过排序规则和 CHARSET 函数?
您可以在这里找到该功能的描述:
http://dev.mysql.com/doc/refman/5.1 /en/information-functions.html
我认为根据您的需要,它更适合 COERCIBILITY 函数。您可以执行以下操作:
如果此函数返回 0,那么您必须编辑该行。
have you tried the collation and CHARSET functions on your descr column?
You can find the description of this functions here:
http://dev.mysql.com/doc/refman/5.1/en/information-functions.html
I think for your need it fits better the COERCIBILITY function. You can do something like:
and if this function returns 0 then you must edit the line.