That's cause I AM A TOTAL SCRUBUSE NorthwindGOCREATE TABLE xORRecord(TimeOperationBegan datetime, TimeOperationEnded datetime)GOINSERT INTO xORRecord (TimeOperationBegan, TimeOperationEnded)SELECT '1899-12-30 10:40:00.000','1899-12-30 11:22:00.000'UNION ALLSELECT '1899-12-30 11:41:00.000', '1899-12-30 11:52:00.000'UNION ALLSELECT '1899-12-30 16:03:00.000', '1899-12-30 16:32:00.000'UNION ALLSELECT '1899-12-30 23:05:00.000', '1899-12-30 00:32:00.000'GOSELECT TimeOperationBegan , TimeOperationEnded , CASE WHEN TimeOperationBegan < TimeOperationEnded THEN DATEDIFF(mi,TimeOperationBegan,TimeOperationEnded) ELSE DATEDIFF(mi,TimeOperationBegan,DATEADD(d,1,TimeOperationEnded)) END AS Diftime FROM xORRecordGODROP TABLE xORRecordGO
As far as the other problem...Looking at your subject, if the patient is being operated on for over 24 hours, I think s/he'd be dead...That should get you through the overnight period....Do you work with the ICD-9 sheets?Or is this a separate OR tracking app?Brett8-)