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.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Datediff between two datetime fields

Author  Topic 

dougancil
Posting Yak Master

217 Posts

Posted - 2010-11-02 : 11:07:29
I am trying to calculate the minute difference between two datetime fields in my database and I'm getting a value of 0 back. Can anyone help me understand why this may be happening?

here is my query:

Select
DateDiff(mm, starttime, IsNull(starttime, endtime))
From Exceptions2

I'm using SQL 2000.

Thank you,

Doug

dougancil
Posting Yak Master

217 Posts

Posted - 2010-11-02 : 11:16:28
I got this figured out ... I was missing something very simple:

SELECT datediff(minute, starttime, endtime) as duration from Exceptions2
where exceptiondate between '5/1/2010' and '5/15/2010'

Thank you,

Doug
Go to Top of Page
   

- Advertisement -