select * from tb where where patindex('%[吖-咗]%',字段)>0
declare @tb table (id int,num1 varchar(50)) insert into @tb select 1,'a' insert into @tb select 2,'你好'select * from @tb where patindex('%[吖-咗]%',num1)> 0id num1 2 你好
select patindex('%[^啊-做]% ','基本工资+a3+a4')
patindex('%[吖-咗]%',字段)> 0我看小梁的这个可行.
declare @S Nvarchar(100) Set @S=N'21321长安6350SCC' Select PatIndex(N'%[吖-座]%',@S) Select PatIndex(N'%[^吖-座]%',@S)
declare @item varchar(500),@item2 varchar(500) select @item='基本工资+a3+a4',@item2='a1+a3+a4' select case when PatIndex(N'%[吖-座]%',@item)>0 then '有中文' else '没有中文' end, case when PatIndex(N'%[吖-座]%',@item2)>0 then '有中文' else '没有中文' end/* -------- -------- 有中文 没有中文(所影响的行数为 1 行) */
patindex('%[吖-咗]%',字段)> 0 这个好。
create table tb(item varchar(50)) insert into tb values('基本工资+a3+a4') insert into tb values('a1+a3+a4')select item, case when PatIndex(N'%[吖-座]%',item)>0 then '有中文' else '没有中文' end [是否有中文] from tbdrop table tb/* item 是否有中文 -------------------------------------------------- -------- 基本工资+a3+a4 有中文 a1+a3+a4 没有中文(所影响的行数为 2 行)*/
insert into @tb select 1,'a'
insert into @tb select 2,'你好'select * from
@tb where patindex('%[吖-咗]%',num1)> 0id num1
2 你好
Set @S=N'21321长安6350SCC'
Select PatIndex(N'%[吖-座]%',@S)
Select PatIndex(N'%[^吖-座]%',@S)
select @item='基本工资+a3+a4',@item2='a1+a3+a4' select case when PatIndex(N'%[吖-座]%',@item)>0 then '有中文' else '没有中文' end,
case when PatIndex(N'%[吖-座]%',@item2)>0 then '有中文' else '没有中文' end/*
-------- --------
有中文 没有中文(所影响的行数为 1 行)
*/
insert into tb values('基本工资+a3+a4')
insert into tb values('a1+a3+a4')select item,
case when PatIndex(N'%[吖-座]%',item)>0 then '有中文' else '没有中文' end [是否有中文]
from tbdrop table tb/*
item 是否有中文
-------------------------------------------------- --------
基本工资+a3+a4 有中文
a1+a3+a4 没有中文(所影响的行数为 2 行)*/
这样行不?试下