Well i have on a server instaled a sqlexpress and in a query i have a little problem with the decimals.
I have the query:
select (20/100+1) AS number from documents
the value that return is 1 when it should return 1,2
o.0
somebody know what this is?
Printable View
Well i have on a server instaled a sqlexpress and in a query i have a little problem with the decimals.
I have the query:
select (20/100+1) AS number from documents
the value that return is 1 when it should return 1,2
o.0
somebody know what this is?
Both number are integer values go you get an integer result. Add a number to make it a decimal value
From the SQL Server documentation for the / (Divide) operator:Documentation is worth a read now and again.Quote:
Result Types
Returns the data type of the argument with the higher precedence. For more information, see Data Type Precedence (Transact-SQL).
If an integer dividend is divided by an integer divisor, the result is an integer that has any fractional part of the result truncated.