SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 datetime query
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

nilaavu
Starting Member

18 Posts

Posted - 12/17/2005 :  22:59:24  Show Profile  Reply with Quote
I have a TIMEIN and TIMEOUT smalldatetime field

In my sp I have
SELECT convert(VARCHAR ,TIMEIN, 8) ,convert(VARCHAR ,TIMEOUT, 8) , DATEDIFF(n, TIMEIN, TIMEOUT) as DURATION

Here if the TimeOut field is 00:00:00 then I dont need to find out the duration , it can be blank or 00:00:00

How can I get this work inside my query?

thanks

SamC
White Water Yakist

USA
3459 Posts

Posted - 12/17/2005 :  23:19:29  Show Profile  Reply with Quote
quote:
Originally posted by nilaavu

Here if the TimeOut field is 00:00:00 then I dont need to find out the duration , it can be blank or 00:00:00

How can I get this work inside my query?


SELECT convert(VARCHAR ,TIMEIN, 8) ,
       convert(VARCHAR ,TIMEOUT, 8) , 
       CASE WHEN CONVERT(VARCHAR, TIMEOUT, 8) = '00:00:00' 
            THEN '00:00:00' 
            ELSE DATEDIFF(n, TIMEIN, TIMEOUT) 
       END  as DURATION



Edited by - SamC on 12/17/2005 23:24:29
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000