This is the first of what I hope to be a long series of posts that demonstrate some new features of SQL Server Reporting Services in the 2008 R2 upcoming release. At some point I may define and go into more detail but for now, I simply want to expose you, the reader, to some new features in the next version of SQL Server Reporting Services (SSRS).

At the company that I work for, we have created a series of reports that have been enhanced over the years based on customer feedback. These reports were built on SQL Server 2005 while it was in beta. The application is still running in SQL 2005 and it uses all of the BI componants of SQL Server –

Enough of the background….
The Problem
One of our enhancements was taking several reports that were very similar in nature and combining them into one report. The key requirement was that these reports need to export into seperate tabs when exported into Excel. This meant that the user could run one report that contained several pages of seperate reports where as before the user would have had to run the reports seperately. We were able to tell SSRS to create a new page for each grouping of the dataset and so we combined all of the seperate reports into one dataset and seperated the data by using these groups. This worked well with one problem. When you export the data to Excel it names the sheets “Sheet 1”, “Sheet 2”, etc… There was no way to control this nameing without really digging under the covers of the rendering engine and creating custom code. Newsgroups were full of posts enquiring on how to name sheets in Excel with no good answers.

There was hope… SQL Server 2008 was released… but still no solution. Denied!

The Solution
Back in November I got my first view of SSRS 2008 R2 Nov CTP release during a presentation at SQL PASS. Bob Meyers and Sean Boon did a great job of showing off many new features of SSRS – many of these will hopefully be bloged in the next parts of this series soon. At the end they did a quick demo and showed that in the R2 release we will have the ability to name the sheets for exports to Excel. This 90 second demo earned the applause of the entire room.

Here is how it is done:
I have created a boring and simple report using the Adventure Works database simply for the purpose of showing this feature.
This report simply pulls Sales Person data and groups it by Territory so that each territory has it’s own page.

Here is an example of the report exported to Excel before setting the sheet names.

In order to name the Sheets appropriately all you have to do is select the Group that has the page breaks from the Row Groups shown below

Then in the properties window navigate into the Groups section and find the PageName attribute.  By clicking on this attribute you can select the TerritoryName field from the dataset used to fill the report.  This can be any field or expression that you want to use, but for my example I wanted to use the name of the territory as the name of the sheets.

Here is a screen of the final result – SIMPLE!!

For questions please contact me at BretUpdegraff@Yahoo.com or

Follow me on Twitter www.Twitter.com/bretupdegraff

Posted by: sqlbret | November 17, 2009

Hacking the SQL 2008 R2 Adventure Works Installer

I recently installed SQL Server 2008 R2 on a server that our company to test out and demo new technologies. I was geared up and excited about the promise of learning about some of the new features in SQL 2008 R2. I want to be able to blog about my findings, so it was important that I have a common database (Adventure Works) to work with. My next step after installing R2 was to go to the http://www.codeplex.com/ website and finding the sample databases. After searching the site I found the appropriate samples at http://msftdbprodsamples.codeplex.com/.

After running the installation file I received the following error (A fatal error occurred during installation):
Figure A

So my first thought was “Why is this trying to install on SQL 2005??” The install package did not give me any options to change this… I then remembered that this server has SQL 2005 installed in the DEFAULT instance, SQL 2008 in an instance called SQL2008 and SQL 2008 R2 was installed in the SQL 2008 installation directory and assigned the instance name SQL2008R2.

Hopefully if others are having this issue, they can use the method that I found in order to resolve this. Hopefully you will pull out a lot less hair than I did.

1.) Enable FILESTREAM for SQL Server 2008 R2
This is important regardless of how you are installing the sample databases.
You do this by navigating to the SQL Server Configuration Manager and select the SQL Server Services on the left side of the window.
On the right side, navigate to the SQL Server 2008 R2 Instance (for me this is SQL2008R2) and right-click and choose Properties as shown in Figure B.

Figure B

From the Properties menu be sure that the Enable FILESTREAM for Transact-SQL access check box.

Figure C

2.) Hack the install file
Change the Adventure Works Database Installation file by renaming the file from AdventureWorks2008R2_NovemberCTP.exe to AdventureWorks2008R2_NovemberCTP.zip Using an unzip utility program, extract the files into any directory. Once you have extracted the files, you will see something similar to that following screen shot.

Figure D

Inside the 2nd, 3rd, and 4th folders are the installation scripts and .csv files that are used to fill the tables.Each folder has a file called instawdwdb.sql.
For now, open the AdventureWorks 2008R2 Data Warehouse folder.

3.) Open and set SQLCMD Mode
From the AdventureWorks 2008R2 Data Warehouse folder open the instawdwdb.sql file using Microsoft SQL Server Management Studio and then set Management Studio to run in SQLCMD Mode.
To set this mode, go into the Query menu and select SQLCMD Mode.

Figure E

4.) Set install variables
Change the variables to use the correct DatabasePath and SourceDataPath.
You will see some code that is commented out …

-:setvar SqlSamplesDatabasePath “C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA\”

–:setvar SqlSamplesSourceDataPath “C:\Program Files\Microsoft SQL Server\100\Tools\Samples\”

You will need to uncomment these lines by taking out the “–” (be sure to leave the colon “:”) and change the value to the appropriate paths per your installation.

Figure F

SqlSamplesDatabasePath – this should be your path to where you want the datapath for your .mdf and .ldf files.
SqlSamplesSourceDataPath – this path should be the directory that you extracted the installation files (Figure D)

5.) Run the Script against the Master Database6.) Repeat steps 1-5 for the AdventureWorks 2008 LT folder7.) Repeat steps 1-5 for the AdventureWorks 2008 OLTP That’s it! Easy right? I hope this helps others! Now that you have access to the AdventureWorks for SQL Server 2008 R2 – start learning everything you can about the new features of this product. For questions please contact me at BretUpdegraff@Yahoo.comFollow me on Twitter www.Twitter.com/bretupdegraff

Posted by: sqlbret | November 12, 2009

SQL Server 2008 R2 – November CTP

I am installing the Nov CTP on my machine today. I am eager to start learning and understanding all that is coming! I started my Blog today and this is my first post… baby steps – right? I have also downloaded the iPhone App – so we may actually see some posts since, according to my wife, my iPhone is glued to my face and hands!!

The install process for the CTP is proving to be an all day event – oh well, I am sure it will be worth it.

CTPInstall

Categories