I'm using a query to pull a report for our 3rd shift folks.
The issue I just noticed when the report was mailed with 0 results is that I have it set right now to run from 6pm to 5:59am the next morning. Since I have the date field = the GETDATE
, it doesn't see the results from the night prior(1800-2359). I was thinking of having this just pull from like -12 hours, but the button can be pressed at anytime to look at results.
So if they pushed it before the end of the shift, it would show some of 1st shifts entries. I want it to only run from 1800-0559 the next morning, no matter if the button is pressed before midnight or after midnight. I hope this makes sense. I'm not even sure if the between recognizes to go to 00 after it's hit 2359. I have this built into a VB.net application, and they can press the button anytime they want to get results. This is for management to track what is being done as the employees are required to enter data real time when issues are taking place.
Thanks for any help. Hope I made enough sense! :D
SELECT
Assignment, Datemodified, General,
IncNumber, NextSteps, PDCRStatus,
RootCause, Status, Summary,
Timings, UserID
FROM
Turnover
WHERE DATEPART(HOUR, datemodified) between 18 and 05
AND CONVERT(NVARCHAR(50),datemodified,103) = CONVERT(NVARCHAR(50),GETDATE(),103);