Lesson 1: Creating a Sample Subscriber Database

Before you can define a data-driven subscription, you must have a data source that provides subscription data. In this step, you will create a small database to store the subscription data used in this tutorial. Later, when the subscription is processed, the report server retrieves this data and uses it to customize report output, delivery options, and report presentation format.

This lesson assumes you are using Management Studio to create a SQL Server 2012 database.

To create a sample Subscriber database

  1. Start Management Studio, and open a connection to a Database Engine.

  2. Right-click on Databases, select New Database....

  3. In the New Database dialog box, in Database Name, type Subscribers. Click OK.

  4. Click the New Query button on the toolbar.

  5. Copy the following Transact-SQL statements into the empty query:

    Use Subscribers
    CREATE TABLE [dbo].[OrderInfo] (
        [SubscriptionID] [int] NOT NULL PRIMARY KEY ,
        [Order] [nvarchar] (20) NOT NULL,
        [FileType] [bit],
        [Format] [nvarchar] (20) NOT NULL ,
    ) ON [PRIMARY]
    GO
    
    INSERT INTO [dbo].[OrderInfo] (SubscriptionID, [Order], FileType, Format) 
    VALUES ('1', 'so43659', '1', 'IMAGE')
    INSERT INTO [dbo].[OrderInfo] (SubscriptionID, [Order], FileType, Format) 
    VALUES ('2', 'so43664', '1', 'MHTML')
    INSERT INTO [dbo].[OrderInfo] (SubscriptionID, [Order], FileType, Format) 
    VALUES ('3', 'so43668', '1', 'PDF')
    INSERT INTO [dbo].[OrderInfo] (SubscriptionID, [Order], FileType, Format) 
    VALUES ('4', 'so71949', '1', 'Excel')
    GO
    
  6. Click ! Execute on the toolbar.

  7. Use a SELECT statement to verify that you have three rows of data. For example: select * from OrderInfo

Next Steps

You have successfully created the subscription data that will drive report distribution and vary the report output for each subscriber. Next, you will modify the data source properties of the report you will distribute to subscribers. Modifying the data source properties is done to prepare the report for data-driven subscription delivery. You will also modify the report design to include a parameter that the subscription will use with the subscriber data. Lesson 2: Modifying the Report Data Source Properties.

See Also

Tasks

Create a Data-Driven Subscription (SSRS Tutorial)

Concepts

Create a Database

Create a Basic Table Report (SSRS Tutorial)

Other Resources

Adding Rows by Using INSERT and SELECT