Dela via


How to: Create a Report (Reporting Services)

Use these steps to add a new report to an existing report server project. To build a report in Report Designer, a component of SQL Server Business Intelligence Development Studio, you must have a Report Server or Report Server Wizard project. You create the report, add report datasets, and arrange the layout of the data and graphical elements. You can also add interactive features to your report and work with the output by using expressions. When the report is complete, you can use Report Designer to preview the report and publish it to the report server.

When you create a report using Report Designer or another tool, you are actually creating a report definition. A report definition contains information about the data source, the structure of the data, and the layout of the data and objects on the report. A report definition is stored as a Report Definition Language (RDL) file in a Report Server project.

Note

This section describes how to use Report Designer to create reports. However, you can create a report in any application that can generate RDL files. For more information, see Designing and Implementing Reports (Reporting Services).

You can also use the Report Wizard to create a report server project. On the File menu, point to New, and then click Project. In the New Project dialog box, click Report Server Project Wizard.

To create a blank report

  1. On the Project menu, click Add New Item. Alternatively, right-click the Reports folder in the project in Solution Explorer, point to Add, and then click New Item.

  2. In the Categories list, click Report Project.

  3. In the Templates list, click Report.

  4. Type a name for the report, and then click Add.

    Note

    The name of the report must have an .rdl extension. Otherwise, Report Designer cannot modify the file correctly.

To create a report using Report Wizard

  1. On the Project menu, click Add New Item. Alternatively, right-click the Reports folder in the project in Solution Explorer, point to Add, and then click New Item.

    Note

    You can also open the Report Wizard by right-clicking the Reports folder in Solution Explorer and then clicking Add New Report. If you use this method, skip to step 5.

  2. In the Categories list, click Report Project.

  3. In the Templates list, click Report Wizard.

  4. Type a name for the report, and then click Add.

    Note

    The name of the report must have an .rdl extension. Otherwise, Report Designer cannot edit the file correctly.

  5. On the Welcome to the Report Wizard page, click Next.

  6. On the Select the Data Source page, click New Data Source, type a name for the data source connection, select a data type, and then type the connection string for the data source. To build the connection string, click Edit. To supply credentials, click Credentials. When the string is complete, click Next.

    Note

    When you click Edit, the Connection Properties box appears. The contents of the Connection Properties box varies depending on the type of data source. To change the data source type, click the Change button and select another data source.

  7. In the Design the Query page, type the query string to use for the report. You can type a Transact-SQL query in the Query string box or click Query Builder. This opens a graphical query designer, where you can build a query by using visual representations for the objects in your data source. Then you can run the query and view the result set. After the query is built, click Next.

    Note

    For more information about text-based and graphical query designers, see Query Design Tools in Reporting Services.

  8. On the Select the Report Type page, select Tabular or Matrix, and then click Next. Selecting Tabular produces a report with data arranged in a table. Selecting Matrix produces a report with data arranged in a matrix, or crosstab.

  9. The next page depends on the choice made in the Select the Report Type page.

    • On the Design the Table page, click a field in the Fields list, and then click the Page, Group, or Details button. Alternatively, click and drag the field into the appropriate box. When all fields are chosen, click Next.

      On the Choose the Table Layout page, select a layout for the table, and then click Next.

    • On the Design the Matrix page, click a field in the Fields list and then click the Page, Columns, Rows, or Details button. Alternatively, click and drag the field into the appropriate box. When all fields are chosen, click Next.

    Note

    At this point, you can click the Finish button to accept all remaining defaults and go to the end of the wizard.

  10. On the Choose the Table Style or Choose the Matrix Style page, select a style to apply to the report, and then click Next.

  11. On the Choose the Deployment Location page, type the report server and folder to which you want to publish the report.

    Note

    This page will not be available if you are creating a report. It's available only if you're creating a report server project.

  12. On the Completing the Report Wizard page, verify the name for the report and the rest of the information, and then click Finish.

    The report name will appear as the title in the report.

After the Report Wizard finishes, the report is displayed in Design mode in Report Designer. You can continue to modify the report, save it, and publish it to a report server.