Hi, I am looking to pull records every 6pm and 6 am. let say today is 12/28/2017 6:00pm the records that I will pull will be from 6:00AM to 6:00pm of 12/28/2017. if tomorrow morning 12/29/2017 6:00am the records that I will get will be from 6:00pm of 12/28/2017 to 12/29/2017 6:00am . just what to know if this is possible also in SSRS. Thank you in advance.
in SSRS I can run every 12 hrs and start time is 6:00PM or 6:00AM but how can I handle that in my query? what will be my where clause condition. thanks for the reply.
select *
from tbl_receiving
where createddatetime between @begdate and @enddate
If you actually do schedule the job to run every 12 hours at the 6's, then it's easy. Just subtract (using a negative DATEADD) 12 hours from the current date and time for the start and use the current date and time as the end.
SELECT SomeColumns
FROM dbo.tbl_receiving
WHERE CreatedDateTime >= DATEADD(hh, -12,GETDATE())
AND CreatedDateTime < GETDATE()
;