how to get 2 digits after decimal point in tsql?

前端 未结 8 1128
梦如初夏
梦如初夏 2021-02-02 05:42

I am having problem to format digits in my select column.I used FORMAT but it doesn\'t work. Here is my column:

sum(cast(datediff(second, IEC.CREATE_DATE, IEC.ST         


        
8条回答
  •  忘了有多久
    2021-02-02 06:31

    DECLARE @i AS FLOAT = 2 SELECT @i / 3 SELECT cast(@i / cast(3 AS DECIMAL(18,2))as decimal (18,2))

    Both factor and result requires casting to be considered as decimals.

提交回复
热议问题