开发者

How to round with no trailing zeros in SQL Server 2005?

How to round with no trailing zeros in SQL Server 2005?

  开发者_如何学Go  select round(100.5555, 2)

...yields 100.5500. How to get rid of the zeros?


Try this

select CAST(round(100.5555, 2) AS DECIMAL(8,2))


You could re-cast it as your original datatype, e.g.

SELECT CAST(ROUND(100.5555, 2) AS FLOAT)

However, this sounds like display logic and therefore, I suspect you are better off doing this within your UI rather than your DB.


declare @d decimal(8,2) can help you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜