Prerequisite
We should have some basic knowledge in SQL Server Query and Visual Studio Tool to create SSRS reports, using Visual Studio 2015.
- SQL Server Basic Query
- Visual Studio 2015
How to setup the SSRS environment
If you want to know how to setup the SSRS environment procedure, prerequisites and SSDT, then you can read my previous article at the link given below.
How to create a table in a database
First, create a Product table, using SQL Server Management Studio in SQL Server database. Now, you can add the product details in the Product table.
- CREATE TABLE [dbo].[Products](
- [ProductID] [int] IDENTITY(1,1) NOT NULL,
- [ProductName] [nvarchar](max) NULL,
- [SupplierID] [int] NULL,
- [CategoryID] [int] NULL,
- [QuantityPerUnit] [nvarchar](max) NULL,
- [UnitPrice] [decimal](18, 2) NULL,
- [UnitsInStock] [smallint] NULL,
- [UnitsOnOrder] [smallint] NULL,
- [ReorderLevel] [smallint] NULL,
- [SupplierName] [nvarchar](max) NULL,
- [CategoryName] [nvarchar](max) NULL,
- [Rating] [int] NOT NULL,
- [Discontinued] [bit] NOT NULL,
- CONSTRAINT [PK_dbo.Products] PRIMARY KEY CLUSTERED
- (
- [ProductID] ASC
- )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
- ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
- GO
How to create SSRS project
Open Visual Studio 2015. Go to File menu, point to new and click new project. New Project Window will open, you can select an installed template like “Reporting Services” in Business Intelligence Template and then select the Report Server project, type Project Name SSRSMatrixReport. Choose the project location path and click OK button.
Now, you can see EmployeeTableReport project structure, as shown in the screenshot.
How to create a new report
You can see in the details on how to add new report, using Visual Studio 2015 in Solution Explorer. You can see the step by step procedure, as shown below.
Go to the Reports folder, right-click Reports folder and point to Add New Reports, followed by clicking Add New Report.
The Report Wizard Window will open and click Next button.
As soon as Data Source Window is selected, Data Source Window will open and click Edit button.
The Connection Properties Window will open and type the Server name, select the Authentication, username, password, select or enter a database name and finally, you can check the database connection succeed, followed by clicking the Test Connection button. Now, click OK button.
On selecting Data Source Window, it will open and select the new data source, connection string and click Next button.
The Design Query Window will open and click Query Builder.
The Query Designer Window will open and type the query into the table you want to load the report and execute the SQL query, followed by clicking SQL icon. Now, click OK button.
- select ProductID,ProductName, CategoryName, SupplierName, QuantityPerUnit, UnitPrice, Rating from Products
The Design Query Window will look as shown in the screenshot given below. Now, click Next button.
Report Type Window will open and select the report as Matrix and click Next button.
The Table design Window will open and add table columns, rows and details to display the fields, followed by clicking columns, rows, details button. Now, click Next button.
The completing wizard Window will open, type the Report name and click Finish button.
After creating SSRS project report, you can see Solution Explorer structure, as shown below.
Now, you can see the report design view, as shown below.
Finally, click the preview button to see the report view.
How to deploy the report
Go to Solution Explorer. Right-click the EmployeeTableReport and click the deploy context-menu item.
After successfully deployed the report to Report Server, you will see the information from the output Window, as shown below.
How to run the report
You can see in detail how to run the report, using Report Server in the Browser. You can see the step by step procedures, as shown below.
First, you have to copy the default Report Server URL and paste the same URL into your Browser for the run report Application.
http://localhost/reportserver
Now, you can run the report Application, followed by SSRSMatrixReport and click the ProductReport.
Conclusion
I hope you understood how we can create a Matrix Report, using Report Wizard in SQL Server Reporting Services 2016, how to create a new report, and how to deploy/run the report Application in the Report Server. I have covered all the required things. If you find anything which I missed in this article, please let me know. Please share your valuable feedback or comments and suggestions to improve future articles.