Please help me in converting Excel formula:
F=MEDIAN(MOD(B2,1),$E$2,$D$2)
where B2 is Date value and E2 is Endtime and D2 is start Time.
Example Date: 5/2/2016 22:35
Start Time: 12:00:00 AM
End Time: 11:59:59 PM
I tried this but no correct output:
declare @dtColumn datetime
declare @dtColumn1 time
set @dtColumn='5/2/2016 10:35:00 PM'
set @dtColumn1=CONVERT(char(8),CAST(AVG(CAST(@dtColumn AS FLOAT) - FLOOR(CAST(@dtColumn AS FLOAT))) AS datetime),108)
print @dtColumn1
I should get output as 0.94 from Excel formula. Please help me how to convert it to SQL Server query.