The steps to create a new data-driven subscription are not too terribly different than the steps needed to create a standard subscription. The large difference in the data-driven subscription model is that the parameters for the recipient list and the rendering extension ET are all derived from a query. To aid end users in creating a data-driven subscription, both SQL Server Management Studio and Report Manager have wizards to set up all the information. Remember that to use a subscription, the report's data sources must have stored credentials or no credentials. Creating a Subscriptions DatabaseBefore creating a data-driven subscription, the end user must create a data set that can be used to hold the information for the subscription. To create a Subscriptions database, open the SQL Management Studio and run the following script: use master go if exists(select name from master.dbo.sysdatabases where name = 'Subscriptions') begin drop database [Subscriptions] end create database [Subscriptions] go use [Subscriptions] go create table [SubcriptionInfo] ([To] nvarchar(50), [Format] nvarchar(50), [EmailAddress] nvarchar(50), [EmployeeId] nvarchar(50), [Linked] nvarchar(50), [IncludeReport] nvarchar(50)) go insert into [SubcriptionInfo] ( [To],[Format],[EmailAddress],[EmployeeId],[Linked],[IncludeReport]) select FirstName + ' ' + LastName [To], Format = case (EmployeeId%2) when 0 then 'MHTML' else 'PDF' end, EmailAddress, b.EmployeeId, Linked = case (EmployeeId%2) when 0 then 'True' else 'False' end, IncludeReport = case (EmployeeId%2) when 0 then 'True' else 'False' end from AdventureWorks.Sales.SalesPerson a, AdventureWorks.HumanResources.Employee b, AdventureWorks.Person.Contact c where a.SalesPersonId = b.EmployeeId and c.ContactId = b.ContactID The preceding script creates a new database called Subscriptions. When setting up the data-driven subscription, a custom data source is created to connect to the table and pull the subscription information. It also pulls in the salespeople information from the AdventureWorks catalog, and sets some preferences. Report ManagerLike everything else thus far, you can use both SQL Server Management Studio and Report Manager to create data-driven subscriptions. As always, we start with Report Manager, and later show you how to create data-driven subscriptions with SQL Server Management Studio. The following steps show how to create a data-driven subscription using Report Manager:
SQL Server Management StudioAs previously mentioned, data-driven subscriptions can be created using SQL Server Management Studio as well as Report Manager. The following steps show how to re-create the data-driven subscription created earlier through Report Manager using SQL Server Management Studio:
|