Before I actually start explaining and demonstrating how to build SQL Server Reporting Service (SSRS) reports there are few things you must have installed or restored before you can begin. As mentioned in my previous post, SQL Server 2012 for Beginners, this is a journey. While the first part of the journey is focused on SSRS, there is a possibility that we may take short excursions that explain or demonstrate other features and capabilities of SQL Server. As with the case of this post.
Let’s get started.
Prerequisites
- SQL Server 2012 Database Engine sp1
- SQL Server Management Studio sp1
- SQL Server Data Tools sp1
- SQL Server Reporting Services 2012 sp1
- Restored Copy of the ContosoSchoolsDW database
I am going to go against the main purpose of these blog posts by assuming that the first 4 have already been installed, configured, and that you have been given access to the Database Engine and the Report Server. With that said, I am going to back track eventually and explain how to install and configure each in future posts. Hopefully, that is ok for now. If not, please feel free to contact me and I would be happy to direct you to resources that could assist you in getting these set up. One thing that I can suggest is that you go out and pre-order a copy SQL Server 2012 Step By Step (SHAMELESS PLUG), which explains how to setup and configure each.
Now that you have all the required tools in place, the next step is the restore the database that will be used throughout the demonstrations. You can click HERE to download the backup file. Ensure that the account that is specified to run the SQL Server Database engine has access to the download location.
Watch the Video if you prefer:
Restore a Database
Using SQL Server Management Studio (SSMS) you can restore a database several ways. In this posting I will explain how to restore a database using SSMS Graphical User Interface (GUI) and TSQL. Since these are introductory posts the main focus will be on the GUI, however I will provide a sample (Transact SQL) T-SQL script that restores the database.
Restoring a Database with SSMS
- Open SSMS
- The Connect to Server window will open. Select Database Engine from the Server type drop down list.
- Enter your server name in the Server name drop down list.
- Select your Authentication method from the Authentication drop down list.
- If you selected SQL Server Authentication you must enter your User name and Password in the corresponding checkboxes.
- Click the button labeled Connect.
- The Object Explorer should be open on the left-side of the SSMS window. If it is not press F8 to open it or in the menu select View | Object Explorer.
- Expand the SQL Server instance that you are connected to.
- Right-click on the Databases folder and select Restore Database from the context menu that appears.
- The Restore Database window will open.
- Ensure that General is selected in the Select a page pane located in the left section of the window.
- The options of this page are divided into three sections, Source, Destination and Restore Plan.
- In the Source section select the radio button labeled Device.
- Click the Ellipses button located to the right of the Device textbox and the Select backup devices window will open.
- Ensure that File is selected in the Backup media type drop down list.
- Click the button labeled Add and the Locate Backup File window will open.
- Navigate to the location where you download the ContosoSchoolDW.bak file and select it.
- Click the OK button.
- You will return to the Select backup devices window.
- Click OK.
- Back on the main Restore Database window your screen should resemble the following:
- Select Files in the Select a page pane.
- Now this is where things can get tricky if you are not familiar with restoring SQL Server databases.
- Expand the Restore As column and ensure that the path specified in each row does exist. The path specified in this column may be different than the one specified in the Original File Name column.
- Click OK and the database restore will begin.
Once the database restore is complete you can begin querying its contents. If you receive any errors or have any questions about the contents of this post please feel free to post a comment here.
Restoring a Database using TSQL
- Open SSMS.
- The Connect to Server window will open. Select Database Engine from the Server type drop down list.
- Enter your server name in the Server name drop down list.
- Select your Authentication method from the Authentication drop down list.
- If you selected SQL Server Authentication you must enter your User name and Password in the corresponding checkboxes.
- Click the button labeled Connect.
- In the menu bar locate and click New Query.
- Enter and execute the following query:
USE
[master]
RESTORE DATABASE [ContosoSchoolsDW]
FROM DISK = N’C:\SQL Server\backup\ContosoSchoolsDW.bak’
WITH FILE = 1,
MOVE N’CrescentSchools’ TO N’C:\SQLServer\data\CrescentSchools.mdf’,
MOVE N’CrescentSchools_log’ TO
N’C:\SQL Server\log\CrescentSchools_log.ldf’,
STATS = 5
GO
Note: If you have already restored the ContosoSchoolDW you will receive and error if you execute the query.
In the next post, Creating a SQL Server Reporting Service Project, I will discuss the differences between a solution and a project and provide the steps to create both.
Talk to you soon,
Patrick LeBlanc, Microsoft, Technical Solutions Professional SQL Server and Business Intelligence
Founder www.sqllunch.com