What is the type of variable? I guess that it is an integer. Right?
– lucJul 09 '09 at 07:53
1 Answers1
66
Try
Select
AVG(Cast(variable as Float)),
SUM(variable)
From
Table
I would suggest using decimal instead of float. See this:
https://stackoverflow.com/questions/1056323/difference-between-numeric-float-and-decimal-in-sql-server
– Pouya BCDMay 24 '18 at 18:53
2
@PouyaBCD Without knowing the precise use-case you can't just suggest to use decimals instead of floats. There exist perfectly valid use-cases for floats/doubles where using decimals would not work well (for example when you need huge ranges, for example numbers from 1e-18 to 1e+18).
– jlhDec 25 '18 at 15:22