转自《https://www.cnblogs.com/mybluesky99/archive/2011/05/18/2050160.html

 

 

网上查了很多资料都没有找到答案。最后无意中发现float类型转换成字符串时就会产生科学计数法的数值字符串:

select cast(cast(1234400000 as float) as varchar)

-----1.2344e+009

 

反向思维,那科学计数法的数值字符串应该可以转换成float类型,再转换float到decimal。

select cast(cast('1.2344e+009' as float) as decimal(18,2))

 

 

总结: 如果是科学计数法的数值字符串,可以先转换成float然后转换成其它数值类型。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-30
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-06
  • 2021-12-10
  • 2022-01-28
  • 2022-12-23
相关资源
相似解决方案