求教一个问题:SQL server可以检测中英文吗?

yinsuxia 2012-10-19 09:44:49
求教一个问题:SQL server可以检测中英文吗?
就是判断某列是否为中文或者英文的方法。。
...全文
181 9 打赏 收藏 转发到动态 举报
写回复
用AI写文章
9 条回复
切换为时间正序
请发表友善的回复…
发表回复
KevinLiu 2012-10-19
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 的回复:]

SQL code
select * from tb where charindex('[a-z]',col)>0


select * from tb where charindex('[吖-坐]',col)>0
[/Quote]

你测试过可行吗?
汤姆克鲁斯 2012-10-19
  • 打赏
  • 举报
回复
select * from tb where charindex('[a-z]',col)>0


select * from tb where charindex('[吖-坐]',col)>0
汤姆克鲁斯 2012-10-19
  • 打赏
  • 举报
回复
能判断是否包含有中文字符或者英文字符
KevinLiu 2012-10-19
  • 打赏
  • 举报
回复
呵呵 阿汤哥这么厉害 我可惹不起啊 徒手爬玻璃强 这个估计没几个人干啊
KevinLiu 2012-10-19
  • 打赏
  • 举报
回复
select *,'Eng' from tb where patindex('%[a-z]%',col)>0 and (patindex('%[吖-坐]%',col)=0)
union all
select *,'CN' from tb where patindex('%[吖-坐]%',col)>0 and patindex('%[a-z]%',col)=0
union all
select *,'Eng&CN' from tb where (patindex('%[吖-坐]%',col)>0) and patindex('%[a-z]%',col)>0

将中英文都包含的字段单独拿出来了。
汤姆克鲁斯 2012-10-19
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 的回复:]

引用 4 楼 的回复:

引用 3 楼 的回复:

引用 2 楼 的回复:

SQL code
select * from tb where charindex('[a-z]',col)>0


select * from tb where charindex('[吖-坐]',col)>0


你测试过可行吗?

应该是

SQL code


se……
[/Quote]

你丫的揪住我不放了啊,坏银

我在1楼说清楚啦啊

再说了非要我写全啊
才这么点分还不知道楼主结贴不呢
--引文
select * from tb where patindex('%[a-z]%',col)>0and patindex('%[吖-坐]%',col)<0
KevinLiu 2012-10-19
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 的回复:]

引用 3 楼 的回复:

引用 2 楼 的回复:

SQL code
select * from tb where charindex('[a-z]',col)>0


select * from tb where charindex('[吖-坐]',col)>0


你测试过可行吗?

应该是

SQL code


select * from tb whe……
[/Quote]

这次对了,但是如果是中文加英文呢?两个都会返回值。
汤姆克鲁斯 2012-10-19
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 的回复:]

引用 2 楼 的回复:

SQL code
select * from tb where charindex('[a-z]',col)>0


select * from tb where charindex('[吖-坐]',col)>0


你测试过可行吗?
[/Quote]
应该是



select * from tb where patindex('%[a-z]%',col)>0


select * from tb where patindex('%[吖-坐]%',col)>0

22,209

社区成员

发帖
与我相关
我的任务
社区描述
MS-SQL Server 疑难问题
社区管理员
  • 疑难问题社区
  • 尘觉
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧