我需要获取不一致的值

时间:2016-03-02 18:09:53

标签: sql sql-server-2008-r2

select term, dial from #archiving where error_code = '308' 

结果:

     term                  dial
  011211928433184        211928433184
    2687176073           12687176073
    2687177729           12687177729
0114317862324b7744      4317862324b7744211
  1.16141E+12             1.16141E+12

我需要排除除了我需要获取术语中所有不一致数字之外的具有十位数字的术语。最后看起来应该是这样的

 term                     dial
011211928433184        211928433184
0114317862324b7744     4317862324b7744211
  1.16141E+12             1.16141E+12

感谢您提前获得帮助

1 个答案:

答案 0 :(得分:0)

这应该这样做:

SELECT term,
      dial
FROM   #archiving
WHERE  error_code = '308'
      AND LEN(CAST(term AS VARCHAR)) <> 10;