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-11-04 : 05:47:16
|
| A table has 2 columns - SDateTime & EDateTime (datatype of both are smalldatetime). One of the records in these 2 columns is 10/01/2008 8:00:00 PM & 10/01/2008 11:30:00 PM respectively. When I run the following query:SELECT DATEDIFF(mi, SDateTime, EDateTime) FROM MyTablethe output is stragely 210 & not 30. Why?Thanks,Ron |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-11-04 : 05:50:28
|
quote: Originally posted by rn5a A table has 2 columns - SDateTime & EDateTime (datatype of both are smalldatetime). One of the records in these 2 columns is 10/01/2008 8:00:00 PM & 10/01/2008 11:30:00 PM respectively. When I run the following query:SELECT DATEDIFF(mi, SDateTime, EDateTime) FROM MyTablethe output is stragely 210 & not 30. Why?Thanks,Ron
Why do you expect 30?MadhivananFailing to plan is Planning to fail |
 |
|
|
raky
Aged Yak Warrior
767 Posts |
Posted - 2008-11-04 : 05:50:56
|
quote: Originally posted by rn5a A table has 2 columns - SDateTime & EDateTime (datatype of both are smalldatetime). One of the records in these 2 columns is 10/01/2008 8:00:00 PM & 10/01/2008 11:30:00 PM respectively. When I run the following query:SELECT DATEDIFF(mi, SDateTime, EDateTime) FROM MyTablethe output is stragely 210 & not 30. Why?Thanks,Ron
hi,The above select stmt gives the difference between sdatetime and edatetime columns in terms of Minutes... |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2008-11-04 : 05:55:23
|
| SELECT DATEDIFF(mi, SDateTime, EDateTime)%60 FROM MyTableMadhivananFailing to plan is Planning to fail |
 |
|
|
|
|
|