gauravbhusal / fun

0 stars 0 forks source link

kha #1

Open gauravbhusal opened 1 month ago

gauravbhusal commented 1 month ago

declare @num decimal = 5

SELECT FLOOR(@num / 6.0) 6 AS rounded_value, ceiling(@num / 6.0) 6 AS rounded_value, round(@num / 6.0, 0) * 6 AS rounded_value

gauravbhusal commented 1 month ago

8/6 = 1 8.0/6 = 1.33 8/6.0 = 1.33

If One value is decimal then other variable will automatically decimal

gauravbhusal commented 1 month ago

declare @num int = 9 declare @num1 decimal = 6

SELECT FLOOR(@num / @num1) @num1 AS lower_value, CEILING(@num / @num1) @num1 AS upper_value, ROUND(@num / @num1, 0) * @num1 AS rounded_value