Using SQL Server 2000
My Query.
SELECT
(Format(IIf(CLng(OutTime) > 180000, CDate('18:00:00'), CDate(Format(OutTime, '00:00:00'))) - IIf(CLng(InTime) < 90000, CDate('09:00:00'), CDate(Format(InTime, '00:00:00'))), 'hh:nn:ss')) As WorkTime,
(Format(IIf(CLng(InTime) < 90000, CDate('09:00:00') - CDate(Format(InTime, '00:00:00')), 0) + IIf(CLng(OutTime) > 180000, CDate(Format(OutTime, '00:00:00')) - CDate('18:00:00'), 0), 'hh:nn:ss')) As OverTime
FROM table
Above query is Access Query, I want to write a same query in sql.
Condition.
I want to Calculate the time after 090000(HH:MM:SS) before 180000 comes in worktime, before 090000 after 180000 comes in overtime.
Intime, Outime data type is varchar in the database
Am new to SQL Server 2000
How to write a SQL query from the above same?