I have written a very long query ( a payroll / timesheet app) and am having issues with only particular UPDATE Query:
SET pr.M_W1_HRS = (CASE WHEN (pt.StartDate = @M_W1) THEN (8.0000 - pt.AbsenceDuration) ELSE pr.M_W1_HRS END),
pr.T_W1_HRS = (CASE WHEN (pt.StartDate = @T_W1) THEN (8.0000 - pt.AbsenceDuration) ELSE pr.T_W1_HRS END),
. (etc, etc for each day of the workweek)
FROM PayrollReport PR
INNER JOIN PTO_Temp pt ON pt.PersonID = pr.EE
I have my main table (PayrollReport) and a temp table (PTO_Temp) which contains durations and dates of time-off occurrences. My date variables contain valid datetime formats, and Im simply trying to subtract 8 from the AbsenceDuration column to arrive at the hours worked for that day. I get no errors running it, but it is not updating the table.
Is my syntax correct in the CASE WHEN Statement?
Thanks in advance!