SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old December 10th, 2003, 11:28 AM
dupati1 dupati1 is offline
Contributing User
ASP Free Novice (500 - 999 posts)
 
Join Date: Oct 2003
Posts: 560 dupati1 User rank is Sergeant (500 - 2000 Reputation Level)dupati1 User rank is Sergeant (500 - 2000 Reputation Level)dupati1 User rank is Sergeant (500 - 2000 Reputation Level)dupati1 User rank is Sergeant (500 - 2000 Reputation Level)dupati1 User rank is Sergeant (500 - 2000 Reputation Level) 
Time spent in forums: 5 Days 21 h 53 m
Reputation Power: 23
Problem with TIME field

Hi,

I am using SQL Server 2000.

I made this following simple query:

SELECT [TimeOperationBegan],[TimeOperationEnded],
(DATEDIFF(minute,[TimeOperationBegan],[TimeOperationEnded])) AS Diftime
FROM [ORRecord]

The sample results are as follows:

TimeOperationBegan |TimeOperationEnded |Diftime
__________________________________________________ ________
1899-12-30 10:40:00.000| 1899-12-30 11:22:00.000| 42
1899-12-30 11:41:00.000| 1899-12-30 11:52:00.000| 11
1899-12-30 16:03:00.000| 1899-12-30 16:32:00.000| 29
1899-12-30 23:05:00.000| 1899-12-30 00:32:00.000| -1353

How can i get rid of this negative value and make the query to calculate the difference between 23:05 and 24:32 for the fourth record??

Thanks in advance.

VJ

Reply With Quote
  #2  
Old December 11th, 2003, 12:00 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
For starters
24:32 on 1899-12-30 is not

1899-12-30 00:32:00.000|

is really

1899-12-31 00:32:00.000|

If you use this it will work

Otherwise it really is a negative value

S-

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Problem with TIME field


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT