April 20, 2006 at 9:22 am
All,
We need to schedule reports from from either T-SQL or C#. Any insight and/or examples would be appreciated.
thanks
pf
April 24, 2006 at 8:00 am
This was removed by the editor as SPAM
August 14, 2006 at 10:48 pm
I know this is really old but I have a little that might help someone down the line.
CREATE TABLE [dbo].[Schedule](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Description] [varchar](1000) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Distance] [char](1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[Multiplier] [int] NULL,
[Correction] [int] NULL,
[Offset] [bigint] NULL,
[DayBitMask] [varchar](7)
)
Using distance, multiplier, correction and offset values, you can create a custom schedule which using dateadd and datepart (in an "engine") allows you to check whether a particular report should be called.
Looking at my design for the "checker" (flowchart)
for each report
1)How many 'd' between epoch and now
2)apply correction to 'd' (ie -1, so if multipler was 2, fortnightly, and you wanted the "other", ie: odd fortnights, not even)
3)is the new d different to the d of the time the report was last run
4)is d mod multipler = 0 (ie: is this the right frequency of d, fortnightly, 3 weekly etc)
5) is daybitmask = 1 for the given dayindex (ie: tuesdays only, can create a report that runs every tues regardless of date)
6) get date for the start of "this" period
7) is periodstart + offset < now
8) report should be run
have fun, purposely not divulging all details
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply