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 |
nilaavu
Starting Member
18 Posts |
Posted - 2005-12-17 : 22:59:24
|
I have a TIMEIN and TIMEOUT smalldatetime fieldIn my sp I haveSELECT convert(VARCHAR ,TIMEIN, 8) ,convert(VARCHAR ,TIMEOUT, 8) , DATEDIFF(n, TIMEIN, TIMEOUT) as DURATIONHere if the TimeOut field is 00:00:00 then I dont need to find out the duration , it can be blank or 00:00:00How can I get this work inside my query?thanks |
|
SamC
White Water Yakist
3467 Posts |
Posted - 2005-12-17 : 23:19:29
|
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:00How can I get this work inside my query?
[CODE]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[/CODE] |
|
|
|
|
|
|
|