---
title: "判断字段中是否包含中文的方法"
author: "unser"
date: "2007-03-28T03:34:04Z"
tags: []
slug: "untitled"
draft: false
lastmod: "2007-03-28T03:34:04Z"
id: 66023
url: "https://unser.iteye.com/blog/66023"
---

![程序代码](http://www.3km.com.cn/images/code.gif) 程序代码

SQL&gt; select * from csvtest where length(name)!=lengthb(name);

ID NAME  
\----------- --------------------------------------------------------------------------------  
1 宇  
4 年  
1 宇  
1 年

length(column\_name) 字的长度， lengthb(column\_name) 字节的长度，中文是双字节，如 '中国' length( '中国' )＝2；lengthb('中国')＝4。