Sherzod Muminov Sherzod Muminov - 8 months ago 36
SQL Question

rounding and converting value

I have some value with data type Numeric(28,10) (e.g. 128000,0000000000). I want to round it up to 2 significances and convert it into string. What is wrong with this?


where td2.Qty is that value. It coverts it to string, but doesn't round it. Thanks in advance


It does round, but it keeps displaying the zeros because this is how numerics are always displayed.

If you need to stop displaying zeros, convert the value to a different type after the rounding, e.g. float or numeric(28,2):

convert(varchar, cast(round(isnull(td2.Qty,0),2) as numeric(28,2)))