SQL Server Convert a number

余生长醉 提交于 2019-12-11 16:49:59

问题


I have this number: 5.42418E+15 How do I convert this number to a 16 digit number like this: 4383452049412480?

I am doing it manually in excel by formatting that column to Number then I select 1234 format but I want this to be done in Sql server.

Thank you.


回答1:


declare @F as float(53)
set @F = 6713073544159400

select @F
      6.7130735441594E+15

select cast( @F as decimal)
      6713073544159400



回答2:


try this

 CAST ( expression AS data_type [ ( length ) ] )


来源:https://stackoverflow.com/questions/19261831/sql-server-convert-a-number

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!