I wrote a Function who returns around 800000 records in 17-20 Seconds but if i use 7 differernt simple case Statements its time increases to 03 min and 10 seconds.. Can somebody help me.

Table Structure:
Create Table Attendence (dated DateTime,
Location_ID VarChar(3),
fs_time VarChar(6),
employee_id VarChar(32),
Present SmallInt,
time_in VarChar(8),
TimeIN_AMPM VarChar(2),
...