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 |
|
brentos2004
Starting Member
4 Posts |
Posted - 2007-04-10 : 12:08:33
|
| Hi,I am trying to find the difference between two times (timeIN, timeOut)and then populate a new field called "duration of stay" with the difference.The two times are in a table called attendance and the new duration of stay field is to be populated in a table called factAttend2Is there an easy way to do this?Thanks |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-04-10 : 12:11:50
|
| Difference in what terms? hour, minutes, seconds, ms?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-04-10 : 12:12:42
|
| Check out the DateDiff function in books on line (documentation).************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
|
|
brentos2004
Starting Member
4 Posts |
Posted - 2007-04-10 : 12:17:47
|
| The timeIN and timeOut fields are in the following format 01/01/2002 08:02:00 so what I want it to do is disregard the date part and just use the two times to find the difference. In some cases this is hours and some it is just minutes so it would probably be better if it could be done in minutes.Thanks |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-04-10 : 13:35:50
|
| You have gotten 2 answers and 1 follow-up question to your original problem.What is bothering you?Peter LarssonHelsingborg, Sweden |
 |
|
|
|
|
|