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 |
|
SMALLMONEY1
Starting Member
2 Posts |
Posted - 2010-11-05 : 20:36:53
|
| I am trying to include a calculation in my SP of how many pounds are consumed in a day with the following:CAST((50/DATEDIFF(day, date1, date2)) AS DECIMAL(8,2)) LbsPerDayIt will not calculate in decimal, only a whole number since it is a day. Is there a way to make it into a decimal?$50/20 days = 2.5, displays as 2 |
|
|
Sachin.Nand
2937 Posts |
Posted - 2010-11-06 : 06:26:21
|
| 50*1.0/DATEDIFF(day, date1, date2)PBUH |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
SMALLMONEY1
Starting Member
2 Posts |
Posted - 2010-11-08 : 14:33:45
|
| Thank You! for the fix and the explanation. I have been going crazy trying to figure that out. |
 |
|
|
|
|
|