How to round without trailing zeros in SQL Server 2005?

How to round without trailing zeros in SQL Server 2005?

select round(100.5555, 2) 

... gives 100.55 00 . How to get rid of zeros?

+6
rounding sql-server-2005
source share
3 answers

try it

 select CAST(round(100.5555, 2) AS DECIMAL(8,2)) 
+10
source share

You can reuse it as a source data type, for example

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

However, this sounds like display logic, and therefore I suspect that you are better off doing this in your user interface, rather than in your database.

+4
source share

declare @d decimal (8.2) can help you.

+1
source share

All Articles