Link to home
Start Free TrialLog in
Avatar of barkome
barkomeFlag for Canada

asked on

Caste datetime

Okay, so I have this query, with a case statement:

                        
,CASE
				 WHEN Start_Time < DATEADD(HH,9,DATEADD(DAY, DATEDIFF(DAY, 0,Start_Time ), 0)) THEN (DATEDIFF(SS,Start_Time ,DATEADD(HH,9,DATEADD(DAY, DATEDIFF(DAY, 0,Start_Time ), 0))) / 3600.0)
				 WHEN End_Time >= DATEADD(HH,9,DATEADD(DAY, DATEDIFF(DAY, 0,Start_Time ), 0)) THEN (DATEDIFF(SS,DATEADD(HH,9,DATEADD(DAY, DATEDIFF(DAY, 0,Start_Time ), 0)), End_Time) / 3600.0)
				 ELSE 0
				 END AS Time_Diff

Open in new window


For some reason its repeating the value for the first case twice:

 Case 1 - 23
Case 2 - 23

instead of

 Case 1 - 23
Case 2 - 0.21
ASKER CERTIFIED SOLUTION
Avatar of Pawan Kumar
Pawan Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Vitor Montalvão
Would help if you post the values that produces those results.