Unix Technical Forum

Small problem with DateType

This is a discussion on Small problem with DateType within the SQL Server forums, part of the Microsoft SQL Server category; --> I have simply query: SELECT time_start-time_end FROM table1 WHERE [.......] When I run this query, then I see: 1900-01-01 ...


Go Back   Unix Technical Forum > Database Server Software > Microsoft SQL Server > SQL Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 02-29-2008, 04:37 AM
BUSHII
 
Posts: n/a
Default Small problem with DateType

I have simply query:


SELECT time_start-time_end
FROM table1
WHERE [.......]

When I run this query, then I see:
1900-01-01 00:38:00.000
1900-01-01 03:43:00.000
1900-01-01 03:02:00.000
1900-01-01 04:31:00.000

I want to get sum of all this dates and times. How Can I do this?

Best regards
BUSHII


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 02-29-2008, 04:37 AM
David Portas
 
Posts: n/a
Default Re: Small problem with DateType

SELECT SUM(DATEDIFF(S,time_start,time_end)) AS total_seconds
FROM Table1

--
David Portas
SQL Server MVP
--


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

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
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:24 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com