select * from TA  where cast([00001] as int)>5 

解决方案 »

  1.   

    TA表  有一字段为00001 类型为varchar 
    id  00001 
    1    0 
    2    2 
    3    53 
    4  10 
    ... 
    要获得00001大于5的数据 
    select * from TA  where cast(00001 as int)>5 这样为什么不可以?
    ---------------------------------------------------
    00001是数据?select * from TA  where cast('00001' as int)>5 00001是字段?select * from TA  where cast([00001] as int)>5 建议你不要用诸如00001之类的做字段名称.
      

  2.   

    select * from TA  where cast([00001] as int)>5 
      

  3.   

    select * from TA  where [00001]tonumber>5 
      

  4.   

    select * from TA  where [00001]tonumber>5