I want to round 3.8 to 3.5 in sql ,please guide
1 Like
You can use the function FLOOR for that and a little trick to muliply by 2.0 and devide by 2.0:
DECLARE @NUMERIC NUMERIC(8,1);
SET @NUMERIC=3.9;
SELECT @NUMERIC = FLOOR(@NUMERIC * 2.0) / 2.0
SELECT @NUMERIC;
Be aware of negative numbers, you should use the CEILING function for that situation.
1 Like