Home Forums Reporting Services Reporting Services Email Report to list of people that are defined by the report ??? RE: Email Report to list of people that are defined by the report ???

  • Unfortunately this is one of the features of The Enterprise Edition which by the sounds of it you don't have. I seem to rememeber there are some third party tools which can give you this functionality.

    There are a couple of ways of doing this. Idf you only have a handful of people to mail to then setup individual subscriptions set to run to each person. Set them to run once at 02:00 in the morning. This creates your subscription.

    You can query subscription to find which SQL Agent job runs your report:

    SELECT rs.ScheduleID as JOBID, rs.ReportID, c.Name, dbo.Subscriptions.ExtensionSettings, dbo.Subscriptions.Description,

    dbo.Subscriptions.LastStatus, dbo.Subscriptions.LastRunTime, dbo.Subscriptions.EventType, dbo.Subscriptions.Parameters, dbo.Subscriptions.DeliveryExtension,

    dbo.Subscriptions.Version, dbo.Schedule.EventData, dbo.Subscriptions.SubscriptionID, c.Path

    FROM dbo.ReportSchedule AS rs WITH (nolock) INNER JOIN

    dbo.Catalog AS c WITH (nolock) ON c.ItemID = rs.ReportID INNER JOIN

    dbo.Subscriptions WITH (nolock) ON rs.SubscriptionID = dbo.Subscriptions.SubscriptionID AND c.ItemID = dbo.Subscriptions.Report_OID INNER JOIN

    dbo.Schedule WITH (nolock) ON rs.ScheduleID = dbo.Schedule.ScheduleID

    Where c.Name = 'Report Name'

    ORDER BY rs.ScheduleID

    So I would then create a Recipient Table with a field you can look up your recipient on and the ReportID, so you can use the table for multiple reports, and the EventData value from the above query.

    Any of these report can now be sent through reporting services by executing the following:

    insert into reportserver.dbo.[Event]

    ([EventID], [EventType], [EventData], [TimeEntered], [ProcessStart], [BatchID])

    select NewID(), 'TimedSubscription', @EventData, GETUTCDATE(), NULL, NULL

    It's then just a matter of querying your resultset to see which you need to run.

    There are some other more complex and fiddly ways of doing it but this should get you there.

    Geoff.