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 |
|
sidharth.banyal
Starting Member
11 Posts |
Posted - 2009-08-28 : 10:34:56
|
| I have a problem with DateTime.I want to calculate hours occupied for a timespan which i will give as a input.In my table i have two columnsDateFrom DateTothese columns contain information that from this date to this date i have a booking.Now i want to calculate hours for a particular timespan means that in that timespan how many hours are occupied.Basically result should contain sum of all hours which i have in that range.Can anyone help?Sidharth Banyal |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2009-08-28 : 11:03:55
|
| select sum(datediff(hour,datefrom,dateto)) from your_tablewhere ..........MadhivananFailing to plan is Planning to fail |
 |
|
|
sidharth.banyal
Starting Member
11 Posts |
Posted - 2009-08-28 : 11:25:02
|
| thanks a lotSidharth Banyal |
 |
|
|
|
|
|