请问一下我想查询列中哪些是7位,哪些是8位的数据,表达式应该怎么写,请指点,谢谢!!例如:A列
      13556531
     32155163
     6135655
     61313554
     5513587
     3213588查询后:A列  
     13556531
     32155163
     61313554
     
     A列
     6135655    
     5513587
     3213588 

解决方案 »

  1.   

    select * from t where len(A列)=7
    select * from t where len(A列)=8
      

  2.   

    select * from b
    where len(A列)=7
      

  3.   

    select * from tb where len(ltrim(rtrim(A))) = 8select * from tb where len(ltrim(rtrim(A))) = 7
      

  4.   

    select A列 A列 from tableName where len(ltrim(rtrim(A列)))=7 
    UNION ALL
    select A列 A列 from tableName where len(ltrim(rtrim(A列)))=8 
      

  5.   


    declare @t table (id int, name nvarchar(50))
    insert into @t select 1,'fsda'
    insert into @t select 2,'fd'
    select name,len(name) as 'length' from @t