分享

如何判断字段里是否包含中文

 小鱼儿363 2016-10-11
LIKE N'%[吖-咗]%' COLLATE Chinese_PRC_CI_AS
SQL code
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'

如何判断字段里是否包含中文
------回答---------
------其他回答(20分)---------
上面错了
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'
select n from @test where PATINDEX('%[吖-座]%',N)>0
------其他回答(20分)---------
SQL code
LIKE N'%[一-龥]%' COLLATE Chinese_PRC_BIN --或是: LIKE N'%[吖-咗]%' COLLATE Chinese_PRC_CI_AS

详见:SQLServer中文处理
------回答---------

------其他回答(20分)---------

上面错了
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'
select n from @test where PATINDEX('%[吖-座]%',N)>0
------其他回答(20分)---------

SQL code
LIKE N'%[一-龥]%' COLLATE Chinese_PRC_BIN --或是: LIKE N'%[吖-咗]%' COLLATE Chinese_PRC_CI_AS

详见:SQLServer中文处理

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多