Lots of people know the answer to this puzzle, but I am sure there are many who do not know the answer of the same as well. Here is the puzzle again for those who have vacation for the Holidays!
Here is the first script:
-- Decimal is rounded up DECLARE @MyValue DECIMAL(10,2) SET @MyValue = 10000/17 SELECT @MyValue DecResult GO
Here is the second script:
-- Decimal is not rounded up DECLARE @MyValue DECIMAL(10,2) SET @MyValue = 10000/17.0000 SELECT @MyValue DecResult GO
Here is the question –Â When we execute the first script the decimal’s are rounded up and when we execute the second script the decimal’s are not rounded up. WHY?
Just leave your answer in the comments field. I will select two random winners in the first week of January and will send surprise gift worth USD 29.
Reference:Â Pinal Dave (https://blog.sqlauthority.com)