## Rounding issue

 Author Message PSB SSChampion Group: General Forum Members Points: 10338 Visits: 1712 How do I round 0.85415 to 1 ?I am getting a 0 instead .Thanks, Luis Cazares SSC Guru Group: General Forum Members Points: 147038 Visits: 22085 +xPSB - Thursday, March 1, 2018 10:20 AMHow do I round 0.85415 to 1 ?I am getting a 0 instead .Thanks,How are you rounding? What are the data types used? Luis C.General Disclaimer:Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?How to post data/code on a forum to get the best help: Option 1 / Option 2 Lynn Pettis SSC Guru Group: General Forum Members Points: 352635 Visits: 41676 You mean something like this?`DECLARE @num DECIMAL(10,5) = 0.85415;SELECT @num, ROUND(@num,0);` Lynn PettisFor better assistance in answering your questions, click hereFor tips to get better help with Performance Problems, click hereFor Running Totals and its variations, click here or when working with partitioned tablesFor more about Tally Tables, click hereFor more about Cross Tabs and Pivots, click here and hereManaging Transaction LogsSQL Musings from the Desert Fountain Valley SQL (My Mirror Blog) PSB SSChampion Group: General Forum Members Points: 10338 Visits: 1712 SELECT 10103,11828,ROUND(10103/11828,0) As results -- Results coming in as 0. Lynn Pettis SSC Guru Group: General Forum Members Points: 352635 Visits: 41676 +xPSB - Thursday, March 1, 2018 10:55 AMSELECT 10103,11828,ROUND(10103/11828,0) As results -- Results coming in as 0.You are doing integer math, that is why you are getting 0. Add a .0 to one of the numbers. Lynn PettisFor better assistance in answering your questions, click hereFor tips to get better help with Performance Problems, click hereFor Running Totals and its variations, click here or when working with partitioned tablesFor more about Tally Tables, click hereFor more about Cross Tabs and Pivots, click here and hereManaging Transaction LogsSQL Musings from the Desert Fountain Valley SQL (My Mirror Blog) sgmunson SSC Guru Group: General Forum Members Points: 74110 Visits: 6352 As Lynn points out, you are effectively using integer division, which will occur BEFORE the ROUND function has a chance to operate. Whenever you are specifying a constant, and need a decimal result of division, be sure the divisor has a decimal point.Try this:`SELECT 10103, 11828, ROUND(10103 / 11828., 0) As results` Steve‌(aka sgmunson)‌ ‌Health & Nutrition PSB SSChampion Group: General Forum Members Points: 10338 Visits: 1712 Great. Thanks! It worked .