declare @test table(N char(10))insert @test
select '张三' union all
select 'Apple' union all
select '李四' union all
select 'Banana' union all
select '赵六' union all
select 'Orange'如何判断字段里是否包含中文
解决方案 »
- table(id,laseupdate)查询最后修改的日期lastupdate
- 自定义SQL函数,不是可以识别的 内置函数名称。
- 通过排名顺序算积分的语句。急!急!
- 如何循环字段并计算
- 关于不能更改sql密码的问题
- 在sql server中有有像在access里的“是/否”型字段吗?假如有的话是那一个,没有的话又是怎么处理boolean的?
- 如何计算同一张表内字段值出现两次的记录?
- 为什么我的ora8.1.7安装完了以后,出问题
- count(*)内幕?
- 怎样在表中插入图片?(在线等待)
- SQLServer2000疑难问题
- SQLServer,多行中的一列根据条件合并为一行中的一列,用SQL怎么做
select '张三' union all
select 'Apple' union all
select '李四' union all
select 'Banana' union all
select '赵六' union all
select 'Orange'if exists(select 1 from @test where PATINDEX('%[^吖-座]%',N)>0)
print '有汉字'
select '张三' union all
select 'Apple' union all
select '李四' union all
select 'Banana' union all
select '赵六' union all
select 'Orange'select n from @test where PATINDEX('%[吖-座]%',N)>0
厉害啊,能把中文全部选出来么,还有能解释下PATINDEX('%[^吖-座]%',N)是什么意思吗,多谢啦
LIKE N'%[一-龥]%' COLLATE Chinese_PRC_BIN
--或是:
LIKE N'%[吖-咗]%' COLLATE Chinese_PRC_CI_AS
详见:SQLServer中文处理
%[吖-座]%的话,“座”字之后的7个字符是出不来的。declare @test table(N char(10))insert @test
select '张三' union all
select 'Apple' union all
select '李四' union all
select 'Banana' union all
select '赵六' union all
select 'Orange' union all
select '做'select n from @test where PATINDEX('%[吖-座]%',N)>0