张三#
李四2
t王五
*赵六
马p七
刘八
要求:将纯汉字的选取出来刘八

解决方案 »

  1.   

    --> 测试数据:[tb]
    if object_id('[tb]') is not null drop table [tb]
    go
    create table [tb]([name] varchar(5))
    insert [tb]
    select '张三#' union all
    select '李四2' union all
    select 't王五' union all
    select '*赵六' union all
    select '马p七' union all
    select '刘八'select * from [tb]
    where patindex('%[^吖-做]%',name) = 0
    ------------------------
    刘八
      

  2.   

    select * from tb where name not like '%[0-9]%' and not like '%[a-z]%' and not ...
      

  3.   

    select * from [tb] where patindex('%[^吖-做]%',name) = 0
      

  4.   

    where patindex('%[^啊-坐]%',name) = 0
      

  5.   


    select * from DGMOCDS 
    where  patindex(  '%[0-9,a-z,A-Z]%' ,ds004)>0 
      

  6.   

    啊寫錯select * from DGMOCDS 
    where  patindex(  '%[0-9,a-z,A-Z]%' ,ds004)=0
    才對吧 
      

  7.   

    select * from tb 
    where datalength(name)=len(name)*2
      

  8.   

    DATALENGTH 返回字节数 汉字占两个字节
      

  9.   

    - -雙字符符號也一大堆拉,,
    select DATALENGTH(' ')
    麻煩啊- -
      

  10.   

    鬱悶了
    這樣成不
    select * from DGMOCDS
    where  patindex('%[-Z]%',ds004)=0 
      

  11.   

    貌似還是不行,,算了,,我放棄。,,等高手,,
    你實在比較急可以考慮一個一個在後面加- - 
    select * from DGMOCDS 
    where  patindex('%[0-9,a-z,A-Z,*,},{]%' ,ds004)=0 
    之類的- -死人嘎