```
DECLARE @punches TABLE ( PunchIn time, PunchOut time )
INSERT @punches VALUES ('07:58', '16:15')
SELECT PunchIn, PunchOut
, [Hours] = DateDiff(Hour, PunchIn, PunchOut)
, [Days] = CASE WHEN DateDiff(Hour, PunchIn, PunchOut) >= 8 THEN 1 ELSE 0 END
FROM @punches
```

I must let you know that there are a few potential flaws in your logic.1- If someone works a "double-shift" for 16 hours, would this be 2 days?

2- What about someone working an overnight shift?

3- If someone did work 1 day, did you want the hours reduced by 8?

What have you tried, and what happened when you tried it?

What help do you need?

FROM EmployeeAttedance)

Now i want day calculate if Hour=8 then day will be 1

And what have *you* tried to actually do that?

@Hou int

@Hours int

Set @Hou=8

SELECT INTime, Outtime, DATEDIFF(Hour, INTime, Outtime) AS Hours,

if

@Hours= @Hou then Day="1"

FROM EmployeeAttedance

And particular error or just "+++OUT OF CHEESE ERROR AT 14, TREACLE MINE ROAD, ANKH MORPORK+++"?

And what have you done to find out why it's giving an error?