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 |
|
rn5a
Starting Member
25 Posts |
Posted - 2008-10-13 : 03:03:23
|
| A SQL Server DB table has 3 fields - StartDateTime, EndDateTime & Duration. The datatype of the first 2 fields is datetime. The 3rd field - Duration - is the time difference between the first 2 fields. For e.g. if one record under StartDateTime is 05/08/2008 7:00:00 AM & the corresponding record under EndDateTime is 05/08/2008 11:30:00 PM, then the value under the Duration field will be 16:30 i.e. 16 hours & 30 minutes. Please note that I am using ASP.NET to calculate this time difference. I also want the sum of all the records under the Duration field. Now here are my queries:1. What datatype should I set the column Duration to? 2. Should I divide the Duration column into 2 columns (hours & minutes) & set the datatype of the 2 columns to int so that I can get the sum easily?Thanks,Ron |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-10-13 : 03:09:43
|
| refer the below link. it dicusses how to handle duration datahttp://www.sqlteam.com/article/working-with-time-spans-and-durations-in-sql-server |
 |
|
|
|
|
|