有一个表,二个字段,
id(int) acount(float)
  1     310000026549.0
  2     310000026550.0当执行select id, cast(acount as varchar(12)) as acount from table1时得到的就
  1     3.1e+011
  2     3.1e+011请问如何将这个FLOAT字段转换成VARCHAR,而且不是用科学计数法显示。即
  1     3100000026549
  2     3100000025650

解决方案 »

  1.   

    --如果没有小数,可用,如果有,也可用稍改此类方法declare @t table(id int,acount float)
    Insert into @t
    select        1     , 310000026549.0
    union select  2     , 310000026550.0select id, cast(Convert(Decimal(18,0),acount) as varchar) as acount from @t
      

  2.   

    如果不要小数位那就现转成int类型吧!
      

  3.   


    select id, left(convert(varchar(20),acount),12) as acount from table1