Below is script you can use to get scheduled records:
-- Table you requre to hold schedule time and other information
-- you can add other columns too to suite your requirements.
-- Main columns are scheduletype : it hold information if schedule is daily, weekly or monthly
-- Scheduletime : Time when you need to send report
-- Scheduleday : Day of week or month you want to fire report
-- for week Sunday holds value 1, monday 2, ... saturday equal 7 and repeat for next week from 1 to 7
-- for month value for scheduleday is for day of month means 1 is 1st day of month
-- for daily its value doesn't matter
-- other columns are just dependent on requirement
create table #scheduletable
(
reportname varchar(100),
scheduletime time,
scheduletype varchar(10),
scheduledate date,
scheduleday int,
userid int
)
--Note: I am using temporary table. Use table ac
...
Read more »