Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
tegryan
Starting Member
22 Posts |
Posted - 2002-06-26 : 06:15:58
|
| I am using win 2k, SQL server 2k with SP2. This question is best shown by the code.When I execute this:declare @tickets decimal(15,5)set @tickets = 2025/2000Print @ticketsI get:1.00000but when I execute this:declare @tickets decimal(15,5)set @tickets = 2025.0/2000Print @ticketsI get the right anwser:1.01250It seems that the number is being formated like a decimal, but calculated like an integer. How can I get around this? All the numbers coming in are integers, but I need to know the decimal value to perform a ceiling function on it. |
|
|
nivaskhan
Starting Member
17 Posts |
Posted - 2002-06-26 : 06:31:26
|
| use thisdeclare @tickets decimal(15,5) set @tickets = CONVERT(DECIMAL,2025)/2000 Print @tickets since the numbers involved in the division is both integer types,the result is of integer type which is store in deimal variable @tickets So by changing any one number involved in the division to DECIMAL or FLOAT will give you the required result.Regards,Nivas |
 |
|
|
|
|
|