|
-
Dec 10th, 2008, 12:51 PM
#1
Thread Starter
Hyperactive Member
Problem in a query
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?
The Future Is Always The Way To Live The Life
-
Dec 10th, 2008, 01:03 PM
#2
Re: Problem in a query
Both number are integer values go you get an integer result. Add a number to make it a decimal value
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Dec 10th, 2008, 06:48 PM
#3
Re: Problem in a query
From the SQL Server documentation for the / (Divide) operator:
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.
Documentation is worth a read now and again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|