Decimal places in SQL
问题 I am calculating percentages. One example is coming down to 38589/38400 So the percentage is 100*(38589/38400) which equals something like 100.4921875, but the result shows up as 100. How can I get it to be displayed with x number of decimals? Similarly, will the same work if i'd like 2 to be displayed as 2.000000? Thanks! 回答1: You can cast it to a specific data type, which preserves the data type as well as rounding to a certain precision select cast(100*(38589/38400) as decimal(10,4)) FYI