select cast('1000000.1' as int)出错,
select cast('1000000' as int) 就没出错,这是什么原因啊?

解决方案 »

  1.   

    int 是整数类型。
    10000.1是浮点型。
    cast('100.1' as float)就OK
      

  2.   

    select   cast(cast('1000000.1' as decimal) as int)
      

  3.   

    both 2 statements work well in Teradata.....
    i'm not sure how it works in SQL Server.try 
    select cast(1000000.1   as   int)
    to see if it works
      

  4.   

    select cast(1000000.1   as   int) 这个肯定是可以的呀但是select cast('1000000.1'   as   int),得先转float,numeric,decimal后再转int