select  * from price where pid>2000 会报错  因为插入pid的有可能会出现**55**的概率(本人无改正权限)
我想正常运行此语句出错的就不统计入 应该怎么做呢 
谢谢

解决方案 »

  1.   

    select  * from price where pid>2000 and pid not like '%55%'
      

  2.   

    消息 245,级别 16,状态 1,第 2 行
    在将 varchar 值 '**45' 转换成数据类型 int 时失败。
    不行 还是原来的错误
      

  3.   

    pid 是varchar(50)这种结构的
      

  4.   

    select * from price where pid>‘2000’ and pid not like '%55%'
      

  5.   

    select * from 
    (
    select * from price where pid not like '%*%'
    )a
    where convert(int,a.pid)>2000
      

  6.   

    都不行 还是上面的错啊
     是like '%*%' 因为数据不准确就会出现 *55*  *35*这种问题
      

  7.   


    select * from price where pid>'2000' and pid not like '%55%'
      

  8.   

    select * from 
    (
    select * from price where pid not like '%*%'
    )a
    where convert(int,a.pid)>2000  这样会报错 select * from price where pid>'2000' and pid not like '%55%'
    这样不是想要查询的结果   pid>'2000' 和 pid>2不同 
    pid是varchar类型的
      

  9.   

    select * from price where pid>right('00000000' + '2000',8) and pid not like '%55%'
      

  10.   

    [Quote=引用 9 楼 fajangsi 的回复:]
    select * from 
    (
    select * from price where pid not like '%*%'
    )a
    where convert(int,a.pid)>2000 这样会报错把错误贴出来,我看一下