What’s New in SQL Server System and Database Administration
System Administrator Responsibilities
System Databases
System Tables
System Views
System Stored Procedures
Summary
8 Installing SQL Server 2008
What’s New in Installing SQL Server 2008
Installation Requirements
Installation Walkthrough
Installing SQL Server Using a Configuration File
Installing Service Packs and Cumulative Updates
Slipstream Installations
Summary
9 Upgrading to SQL Server 2008
What’s New in Upgrading SQL Server
Using the SQL Server Upgrade Advisor (UA)
Destination: SQL Server 2008 or SQL Server 2008 R2
Upgrading Using a Configuration File
Slipstreaming Upgrades
Upgrading Other SQL Server Components
Summary
10 Client Installation and Configuration
What’s New in Client Installation and Configuration
Client/Server Networking Considerations
Client Installation
Client Configuration
Client Data Access Technologies
Summary
11 Security and User Administration
What’s New in Security and User Administration
An Overview of SQL Server Security
Authentication Methods
Managing Principals
Managing Securables
Managing Permissions
Managing SQL Server Logins
Managing SQL Server Users
Managing Database Roles
Managing SQL Server Permissions
The Execution Context
Summary
12 Data Encryption
What’s New in Data Encryption
An Overview of Data Security
An Overview of Data Encryption
SQL Server Key Management
Column-Level Encryption
Transparent Data Encryption
Column-Level Encryption Versus Transparent Data Encryption
Summary
13 Security and Compliance
Exposure and Risk
Across the Life Cycle
The Security Big Picture
Identity Access Management Components
Compliance and SQL Server
SQL Server Auditing
Setting Up Auditing via T-SQL
SQL Injection Is Easy to Do
Summary
14 Database Backup and Restore
What’s New in Database Backup and Restore
Developing a Backup and Restore Plan
Types of Backups
Recovery Models
Backup Devices
Backing Up a Database
Backing Up the Transaction Log
Backup Scenarios
Restoring Databases and Transaction Logs
Restore Scenarios
Additional Backup Considerations
Summary
15 Database Mail
What’s New in Database Mail
Setting Up Database Mail
Sending and Receiving with Database Mail
Using SQL Server Agent Mail
Related Views and Procedures
Summary
16 SQL Server Scheduling and Notification
What’s New in Scheduling and Notification
Configuring the SQL Server Agent
Viewing the SQL Server Agent Error Log
SQL Server Agent Security
Managing Operators
Managing Jobs
Managing Alerts
Scripting Jobs and Alerts
Multiserver Job Management
Event Forwarding
Summary
17 Administering SQL Server 2008 with PowerShell
What’s New with PowerShell
Overview of PowerShell
PowerShell Scripting Basics
PowerShell in SQL Server 2008
Step-By-Step Examples
Summary
18 SQL Server High Availability
What’s New in High Availability
What Is High Availability?
The Fundamentals of HA
Building Solutions with One or More HA Options
Other HA Techniques That Yield Great Results
High Availability from the Windows Server Family Side
Summary
19 Replication
What’s New in Data Replication
What Is Replication?
The Publisher, Distributor, and Subscriber Magazine Metaphor
Replication Scenarios
Subscriptions
Replication Agents
Planning for SQL Server Data Replication
SQL Server Replication Types
Basing the Replication Design on User Requirements
Setting Up Replication
Scripting Replication
Monitoring Replication
Summary
20 Database Mirroring
What’s New in Database Mirroring
What Is Database Mirroring?
Roles of the Database Mirroring Configuration
Setting Up and Configuring Database Mirroring
Testing Failover from the Principal to the Mirror
Client Setup and Configuration for Database Mirroring
Migrate to Database Mirroring 2008 as Fast as You Can
Using Replication and Database Mirroring Together
Using Database Snapshots from a Mirror for Reporting
Summary
21 SQL Server Clustering
What’s New in SQL Server Clustering
How Microsoft SQL Server Clustering Works
Installing SQL Server Clustering
Summary
22 Administering Policy-Based Management
Introduction to Policy-Based Management
Policy-Based Management Concepts
Implementing Policy-Based Management
Sample Templates and Real-World Examples
Policy-Based Management Best Practices
Summary
Part IV: Database Administration
23 Creating and Managing Databases
What’s New in Creating and Managing Databases
Data Storage in SQL Server
Database Files
Creating Databases
Setting Database Options
Managing Databases
Summary
24 Creating and Managing Tables
What’s New in SQL Server 2008
Creating Tables
Defining Columns
Defining Table Location
Defining Table Constraints
Modifying Tables
Dropping Tables
Using Partitioned Tables
Creating Temporary Tables
Summary
25 Creating and Managing Indexes
What’s New in Creating and Managing Indexes
Types of Indexes
Creating Indexes
Managing Indexes
Dropping Indexes
Online Indexing Operations
Indexes on Views
Summary
26 Implementing Data Integrity
What’s New in Data Integrity
Types of Data Integrity
Enforcing Data Integrity
Using Constraints
Rules
Defaults
Summary
27 Creating and Managing Views in SQL Server
What’s New in Creating and Managing Views
Definition of Views
Using Views
Creating Views
Managing Views
Data Modifications and Views
Partitioned Views
Indexed Views
Summary
28 Creating and Managing Stored Procedures
What’s New in Creating and Managing Stored Procedures
Advantages of Stored Procedures
Creating Stored Procedures
Executing Stored Procedures
Deferred Name Resolution
Viewing Stored Procedures
Modifying Stored Procedures
Using Input Parameters
Using Output Parameters
Returning Procedure Status
Debugging Stored Procedures Using SQL Server Management Studio
Using System Stored Procedures
Startup Procedures
Summary
29 Creating and Managing User-Defined Functions
What’s New in SQL Server 2008
Why Use User-Defined Functions?
Types of User-Defined Functions
Creating and Managing User-Defined Functions
Rewriting Stored Procedures as Functions
Creating and Using CLR Functions
Summary
30 Creating and Managing Triggers
What’s New in Creating and Managing Triggers
Using DML Triggers
Using DDL Triggers
Using CLR Triggers
Using Nested Triggers
Using Recursive Triggers
Summary
31 Transaction Management and the Transaction Log
What’s New in Transaction Management
What Is a Transaction?
How SQL Server Manages Transactions
Defining Transactions
Transactions and Batches
Transactions and Stored Procedures
Transactions and Triggers
Transactions and Locking
Coding Effective Transactions
Transaction Logging and the Recovery Process
Long-Running Transactions
Bound Connections
Distributed Transactions
Summary
32 Database Snapshots
What’s New with Database Snapshots
What Are Database Snapshots?
Limitations and Restrictions of Database Snapshots
Copy-on-Write Technology
When to Use Database Snapshots
Setup and Breakdown of a Database Snapshot
Reverting to a Database Snapshot for Recovery
Setting Up Snapshots Against a Database Mirror
Database Snapshots Maintenance and Security Considerations
Summary
33 Database Maintenance
What’s New in Database Maintenance
The Maintenance Plan Wizard
Managing Maintenance Plans Without the Wizard
Executing a Maintenance Plan
Maintenance Without a Maintenance Plan
Database Maintenance Policies
Summary
Part V: SQL Server Performance and Optimization
34 Data Structures, Indexes, and Performance
What’s New for Data Structures, Indexes, and Performance
Understanding Data Structures
Database Files and Filegroups
Database Pages
Space Allocation Structures
Data Compression
Understanding Table Structures
Understanding Index Structures
Data Modification and Performance
Index Utilization
Index Selection
Evaluating Index Usefulness
Index Statistics
SQL Server Index Maintenance
Index Design Guidelines
Indexed Views
Indexes on Computed Columns
Filtered Indexes and Statistics
Choosing Indexes: Query Versus Update Performance
Identifying Missing Indexes
Identifying Unused Indexes
Summary
35 Understanding Query Optimization
What’s New in Query Optimization
What Is the Query Optimizer?
Query Compilation and Optimization
Query Analysis
Row Estimation and Index Selection
Join Selection
Execution Plan Selection
Query Plan Caching
Other Query Processing Strategies
Parallel Query Processing
Common Query Optimization Problems
Managing the Optimizer
Summary
36 Query Analysis
What’s New in Query Analysis
Query Analysis in SSMS
SSMS Client Statistics
Using the SET SHOWPLAN Options
Using sys.dm_exec_query_plan
Query Statistics
Query Analysis with SQL Server Profiler
Summary
37 Locking and Performance
What’s New in Locking and Performance
The Need for Locking
Transaction Isolation Levels in SQL Server
The Lock Manager
Monitoring Lock Activity in SQL Server
SQL Server Lock Types
SQL Server Lock Granularity
Lock Compatibility
Locking Contention and Deadlocks
Table Hints for Locking
Optimistic Locking
Summary
38 Database Design and Performance
What’s New in Database Design and Performance
Basic Tenets of Designing for Performance
Logical Database Design Issues
Denormalizing a Database
Database Filegroups and Performance
RAID Technology
SQL Server and SAN Technology
Summary
39 Monitoring SQL Server Performance
What’s New in Monitoring SQL Server Performance
Performance Monitoring Tools
A Performance Monitoring Approach
Summary
40 Managing Workloads with the Resource Governor
Overview of Resource Governor
Resource Governor Components
Configuring Resource Governor
Monitoring Resource Usage
Modifying Your Resource Governor Configuration
Summary
41 A Performance and Tuning Methodology
The Full Architectural Landscape
Primary Performance and Tuning Handles
A Performance and Tuning Methodology
Performance and Tuning Design Guidelines
Tools of the Performance and Tuning Trade
Summary
Part VI: SQL Server Application Development
42 What’s New for Transact-SQL in SQL Server 2008
MERGE Statement
Insert over DML
GROUP BY Clause Enhancements
Variable Assignment in DECLARE Statement
Compound Assignment Operators
Row Constructors
New date and time Data Types and Functions
Table-Valued Parameters
Hierarchyid Data Type
Using FILESTREAM Storage
Sparse Columns
Spatial Data Types
Change Data Capture
Change Tracking
Summary
43 Transact-SQL Programming Guidelines, Tips, and Tricks
General T-SQL Coding Recommendations
General T-SQL Performance Recommendations
T-SQL Tips and Tricks
In Case You Missed It: New Transact-SQL Features in SQL Server 2005
The xml Data Type
The max Specifier
TOP Enhancements
The OUTPUT Clause
Common Table Expressions
Ranking Functions
PIVOT and UNPIVOT
The APPLY Operator
TRY...CATCH Logic for Error Handling
The TABLESAMPLE Clause
Summary
44 Advanced Stored Procedure Programming and Optimization
T-SQL Stored Procedure Coding Guidelines
Using Cursors in Stored Procedures
Nested Stored Procedures
Using Temporary Tables in Stored Procedures
Using Remote Stored Procedures
Stored Procedure Performance
Using Dynamic SQL in Stored Procedures
Installing and Using .NET CLR Stored Procedures
Using Extended Stored Procedures
Summary
45 SQL Server and the .NET Framework
What’s New in SQL Server 2008 and the .NET Framework
Getting Comfortable with ADO.NET 3.5 and SQL Server 2008
Developing with LINQ to SQL
Using ADO.NET Data Services
Leveraging the Microsoft Sync Framework
Summary
46 SQLCLR: Developing SQL Server Objects in .NET
What’s New for SQLCLR in SQL Server 2008
Developing Custom Managed Database Objects
Summary
47 Using XML in SQL Server 2008
What’s New in Using XML in SQL Server 2008
Understanding XML
Relational Data As XML: The FOR XML Modes
XML As Relational Data: Using OPENXML
Using the xml Data Type
Indexing and Full-Text Indexing of xml Columns
Summary
48 SQL Server Web Services
What’s New in SQL Server Web Services
Web Services Migration Path
Web Services History and Overview
Building Web Services
Examples: A C# Client Application
Using Catalog Views and System Stored Procedures
Controlling Access Permissions
Summary
49 SQL Server Service Broker
What’s New in Service Broker
Understanding Distributed Messaging
Designing a Sample System
Understanding Service Broker Constructs
Service Broker Routing and Security
Troubleshooting SSB Applications with ssbdiagnose.exe
Related System Catalogs
Summary
50 SQL Server Full-Text Search
What’s New in SQL Server 2008 Full-Text Search
Upgrade Options in SQL Server 2008
How SQL Server FTS Works
Implementing SQL Server 2008 Full-Text Catalogs
Setting Up a Full-Text Index
Full-Text Searches
Full-Text Search Maintenance
Full-Text Search Performance
Full-Text Search Troubleshooting
Summary
Part VII: SQL Server Business Intelligence Features
51 SQL Server 2008 Analysis Services
What’s New in SSAS
Understanding SSAS and OLAP
Understanding the SSAS Environment Wizards
An Analytics Design Methodology
An OLAP Requirements Example: CompSales International
Summary
52 SQL Server Integration Services
What’s New with SSIS
SSIS Basics
SSIS Architecture and Concepts
SSIS Tools and Utilities
A Data Transformation Requirement
Running the SSIS Wizard
The SSIS Designer
The Package Execution Utility
Connection Projects in Visual Studio
Change Data Capture Addition with R2
Using bcp
Logged and Nonlogged Operations
Summary
53 SQL Server 2008 Reporting Services
What’s New in SSRS 2008
Reporting Services Architecture
Installing and Configuring SSRS
Developing Reports
Management and Security
Performance and Monitoring
Summary
Part VIII: Bonus Chapters
54 Managing Linked and Remote Servers
What’s New in Managing Linked and Remote Servers
Managing Remote Servers
Linked Servers
Adding, Dropping, and Configuring Linked Servers
Mapping Local Logins to Logins on Linked Servers
Obtaining General Information About Linked Servers
Executing a Stored Procedure via a Linked Server
Setting Up Linked Servers Using SQL Server Management Studio
Summary
55 Configuring, Tuning, and Optimizing SQL Server Options
What’s New in Configuring, Tuning, and Optimizing SQL Server Options
SQL Server Instance Architecture
Configuration Options
Fixing an Incorrect Option Setting
Setting Configuration Options with SSMS
Obsolete Configuration Options
Configuration Options and Performance
Database Engine Tuning Advisor
Data Collection Sets
Summary
56 SQL Server Disaster Recovery Planning
What’s New in SQL Server Disaster Recovery Planning
How to Approach Disaster Recovery
Microsoft SQL Server Options for Disaster Recovery
The Overall Disaster Recovery Process
Have You Detached a Database Recently?
Third-Party Disaster Recovery Alternatives
Summary
Index
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y-Z
Nội dung
ptg 2224 CHAPTER 53 SQL Server 2008 Reporting Services Check the check box near the bottom that reads Add a Bing Maps Layer; then select Road in the Tile Type drop-down. Integration with Bing Maps will surely give your reports a visual edge over the competition. Notice the new reporting term used on this check box, layer. You can think of maps as collections of z-ordered layers of information. You can add layers to illustrate regions, points, place names, pictures, icons, roads, terrain, perspective, or just about anything else you can conceive of. Click Next; then, on the Choose Map Visualization screen, click the Bubble Map button and then click Next. On the ensuing Choose the Analytical Dataset screen, select the Choose an Existing Dataset radio button and then click on your dataset (usually, it is named DataSet1). Our analytical data illustrates relative numbers of product sales by state; that is, we are relating relative integer values to points in space. Click Next, and, on the ensuing Choose Color Theme and Data Visualization screen, pick a color theme you like (Ocean looks nice). Then make sure the Use Bubble Sizes check box is checked and that the Data field shown in the drop-down contains the simple expression [Sum(Quantity)]. This field is taken directly from the sample dataset. Check the Use Bubble Colors check box, ensure that the data field expression is the same as before, ( [Sum(Quantity)]), and then pick a color you like and click Finish. When you return to the RB3 UI, change the title text for the report to something more meaningful and then run the report. Afterwards, save the report and then look at it using Internet Explorer in Report Manager. No doubt, your users will be very impressed with the result, illustrated in Figure 53.33. Returning to RB3, switch back to Design mode and then click twice on your report’s map control. The Map Layers dialog (appearing against the right edge of the map) functions much like the Layers palette you may have worked with in Adobe Photoshop. It enables you to perform the following tasks: . Show or hide layers . View layer properties . Add new layers (either using a wizard or manually) . Delete layers . Reorder layers (around the z-index) . Zoom in or out on the map (especially useful when using Bing Map layers) . Nudge the map in any direction Using the context menu for each layer in the Map Layers dialog, you can also do the following: . Add or delete layers . Add or remove a map legend or title . Show or hide the distance or color scale ptg 2225 Developing Reports 53 FIGURE 53.33 Viewing a map report designed with RB3 in Report Manager. . Cut, copy, or refresh a layer . Set up rules for how point colors or sizes are displayed We mentioned earlier that maps can also consume nonrelational data sources, such as ESRI spatial data files. A few great public sources of a plethora of these are available: . From the U.S. Centers for Disease Control and Prevention, at the following URL: http://www.cdc.gov/epiinfo/shape.htm . From the U.S. Census Bureau, at the following URL: http://arcdata.esri.com/data/ tiger2000/tiger_download.cfm Let’s take a quick look at a sample map report that uses an ESRI shape file for a country. First, obtain an ESRI shape file of your choice and launch RB3. Then, on the start screen, click Map Wizard and click the Create button. On the Choose a Source screen, select the ESRI Shapefile radio button, click Browse to locate your shapefile (it will have a .shp extension), and then click Next. On the Choose Spatial Data screen, add a Bing Maps layer, zoom the map to your desired size, and then click Next. Choose Basic Map on the next screen and then click Next. Choose a color theme and then click Finish. Change the ptg 2226 CHAPTER 53 SQL Server 2008 Reporting Services title text for your map using the designer surface and then run your report. It’s that simple! The result is illustrated in Figure 53.34. Working with Report Models Although the chart and map control examples used here rely on mid-level T-SQL queries, you can develop reports using a technology that doesn’t require your end users to know anything about SELECT statements, foreign keys, or the physical structure of a database. To make this possible, you build what’s known as a report model (RM)—an abstraction of a database schema (also known as a semantic model) that allows users to work with tables in logical terms, navigating the relationship hierarchies, instead of writing queries. Under the hood, SSRS translates the model elements you add to your reports into native database queries. Other useful features of RMs include column- and row-level security, as well as drill-through link generation for related entities. When the RM is deployed, business users can use it to design their own ad hoc reports with RB3. You design RMs with BIDS, either through an autogeneration process or by using the revamped Model Designer. To get started, launch BIDS and create a new Report Model Project (located under the Business Intelligence Projects list on the Add New Project dialog). In Solution Explorer, notice your new project’s three main folders: Data Source, Data Source Views, and Report Models. Let’s create one of each. Right-click the Data Sources folder; then select Add New Data Source. On the Data Source Wizard’s first screen, leave the first radio button selected; then click the New button and FIGURE 53.34 A map report using an ESRI shapefile of Israel, designed with RB3. ptg 2227 Developing Reports 53 connect to your local instance of AdventureWorks2008R2. After defining and testing your connection, click OK and then click Next. Name the data source whatever you like; then click Finish. Your data source is ready for use. The next step is to create a Data Source View (DSV). RMs require the use of a DSV to access the subset of tables and views you define. You can include all tables and views if you like, but keep in mind that the more you expose, the more complex your model, the longer it takes to generate, the more confused your business users might be. Keep it simple. Right-click the Data Source Views folder in Solution Explorer and select Add New Data Source View. On the ensuing wizard screen, select the data source you just created and then click Next. The Select Tables and Views screen allows you to define the tables and views available to your RB3 users. For this example, move the following tables from left to right using the arrow button and then click Next: Product(Production), ProductReview(Production), and ProductModel(Production). Name your DSV something like AW08_ProductBasics (rather than the default database name) and then click Finish. TIP To be brought into a model, your underlying tables (defined in your DSV) must have primary keys. RB3 uses primary keys to figure out what represents a logical unit in the table. Primary keys are not added to RMs during model generation (using BIDS) by default. Now, all that’s left is to create your RM. Right-click the Report Models folder in Solution Explorer and select Add New Report Model. Accept the default selection of your new DSV and then click Next. On the following screen (Select Report Model Generation Rules), you can tweak the entities (that is, tables), attributes (columns), roles (relations), and aggregates that will be created in your new RM (notice the logical modeling terminology used). Accept the defaults and click Next. On the following screen, you can accept the default behavior of updating the model statistics and click Next. On the last screen, name your model AW08_ProductBasicsModel and then click Next. When the model generation progress bars are all complete, click Finish. Your new RM opens in the BIDS Model Designer. Click F4 to reveal the Properties tool window. Take a moment to explore the design surface. Notice the tree on the left that lists your model’s entities. Click on the Product entity node. In the detail area on the right, notice the attributes that BIDS generated for the Product. Each attribute has an icon indicating its type: check boxes for Boolean-valued attributes, the letter a for strings, a calendar icon for DateTime values, a bracketed group for aggregate results (three vertical dots next to a curly brace), and a pound sign for numeric or scalar values. Notice also how some attributes, such as Weight, are expandable nodes. The child nodes under these are variation attributes, which are based on their parent field. They rely on expressions, such as MIN(Weight), where Weight is the parent attribute and the value of the child Min Weight attribute is the lowest weight. Here’s another example: for our DateTime fields, we have variation attributes for the parent Sell Start Date attribute, ptg 2228 CHAPTER 53 SQL Server 2008 Reporting Services including Start Sell Day, Start Sell Year, Start Sell Month, and Start Sell Quarter (shown in Figure 53.35). Click on the Start Sell Day attribute and view its properties in the Properties tool window. Next, click on the ellipses button for its Expression property. This launches the Formula Designer, which is very much akin to the Expression Editor you learned about in previous examples, albeit much simplified. The Formula Designer has two tabs on the left: one for selecting the model object you want to work with and another containing all manner of functions to run against your model object. On the right, you have a simplified formula editor, which allows for some basic operations in your expression, including math, string concatenation, and grouping. Returning to the Model Designer, scroll down the detail area for your Product entity, until you see Product Reviews and Product Model. These roles represent your table relation- ships. Click either role and view its properties. Notice the Binding, Cardinality, and RelatedRole properties, which store the relationship’s foreign key information, cardinal- ity, and the name of the other participating role. If you right-click any object in the detail area, you can regenerate that model object by selecting Autogenerate. This capability is useful if you make a mistake in a formula or simply want to start fresh. You can also change the order of the objects in the model (by selecting Move Up or Move Down), delete or rename the object. FIGURE 53.35 Viewing an entity’s attributes with Model Designer. ptg 2229 Developing Reports 53 Deploying and Managing Report Model Objects Now that you’re familiar with how RMs work, it’s time to deploy our example. Right-click your project name in the Solution Explorer and select Properties. Ensure that the value of TargetServerURL points to the location of your SSRS web services. Ensure that the TargetModelFolder and TargetDataSourceFolder are the ones where you want these objects to be deployed from your project and then click OK. Right-click your project again; then click Deploy. Launch Report Manager in your browser and then navigate to the folder where you deployed your RM (this is usually Models). Click on your new model ( AW08_ProductBasicsModel) and view its properties. If you want to hide certain objects within the RM from certain users, click the Model Item Security link; then click the check box labeled Secure Individual Model Items Independently for This Model. Then, using the now-enabled tree control, click the item you want to secure and set permissions using the radio buttons below the tree. Users who are denied access to model objects won’t even see the entities in RB3. Even more, if they run existing model-based reports that reference these entities, the columns to which they lack access are automatically filtered out by the query generation layer. Working with Report Models in RB3 Now that your RM is deployed, it’s time to launch RB3 again to create a simple report that uses it. Start RB3, and when it opens (on the New Report or Dataset window), click the Table or Matrix Wizard button and then click Create. On the following screen, select the Create a Dataset radio button and then click Next. On the Choose a Connection screen, click the Browse button; then navigate to your new Models folder in the SSRS catalog. Click to select your model ( AW08_ProductBasicsModel), click Open, and then click Next (see Figure 53.36). FIGURE 53.36 Selecting your report model as an RB3 data source. ptg 2230 CHAPTER 53 SQL Server 2008 Reporting Services As you can see, the Query Designer (QD) also supports building a query from an RM. After you add a field, if you click the Edit as Text button, you see that the QD generates a Semantic Model Query Language (SMQL) XML document for RMs rather than a T-SQL query. The RM itself is described by a Semantic Model Definition Language document, and this is the same SMDL used by the Entity Framework. The QD’s explorer pane includes the same Entities and Fields areas found on the BIDS Model Designer surface. The QD also offers a helpful search feature to locate RM objects, an advanced viewing mode, as well as the capability to create and add new fields to the RM on the fly. Drag and drop the following fields into the Design area (top right): Product.Product Number , ProductModel.Name, ProductReview.Rating (a variation attribute of ProductReview.Total Rating), ProductReview.Review Date, and ProductReview.Reviewer Name. Click the Run button (the exclamation point) to verify that your results resemble those shown in Figure 53.37 and then click Next. On the Arrange Fields screen, drag any one of the fields into the Values pane and then click Next. Accept the defaults on the ensuing screen, click Next, choose a color theme, and then click Finish. For clarity, Listing 53.8 provides a T-SQL version of the query you just built using the RM. FIGURE 53.37 Building a report model SMQL query using Query Designer. ptg 2231 Developing Reports 53 LISTING 53.8 T-SQL Representation of the Sample Report Model SMQL Query SELECT p.ProductNumber, m.Name, r.Rating, r.ReviewDate, r.ReviewerName FROM Production.Product p JOIN Production.ProductReview r ON r.ProductID = p.ProductID JOIN Production.ProductModel m ON p.ProductModelID = m.ProductModelID Returning to RB3, notice your new dataset in the Report Data pane. Using the design surface, click once on the auto-created Tablix control, click its drag handle, and then press the Delete key to remove it. On the Insert tab of the Ribbon bar, click the List control button; then draw a list data region on the design surface where the table used to be. Click in the middle of the list to reveal its Tablix borders, right-click its detail group row (this row has three horizontal lines in its middle), and then select Tablix Properties. On the General tab, under Dataset Name, use the drop-down to select DataSet1 (the default name of the RM-based dataset you just created), then click OK. Returning to the Insert Ribbon bar menu, click on the Textbox control button and draw a text box across the top third of your list control. Click once on the empty area of your list, right-click your new text box, and select Expression. For the value of the expression, enter the following and then click OK: =”Product: “ & Fields!Product_Number.Value & “ (“ & Fields!Product_Model.Value & “)” & vbCrLf & “Reviewer: “ & Fields!Reviewer_Name.Value & vbCrLf & “Review Date: “ & Fields!Review_Date.Value Returning to the Insert Ribbon bar menu, click the Gauge control button; then draw a gauge that occupies the bottom two thirds of the list control. Select the 180 Degrees North radial style gauge and then click OK. Right-click the gauge and select Gauge Panel, Scale Properties. On the Radial Scale Properties dialog, set the Minimum drop-down value to 0 and the Maximum to 5; then click OK. Right-click the gauge again and select Gauge Panel, Pointer Properties. In the Value drop-down, enter the simple expression [Rating] and then click OK. Right-click the designer surface (outside the boundary of the report); then click Remove Page Footer. Change the title for your report. Then, using the Line control from the Insert Ribbon menu, draw a line at the bottom of your list (just below your gauge) to separate list item repetitions during report execution. Your design surface should now resemble the one shown in Figure 53.38. ptg 2232 CHAPTER 53 SQL Server 2008 Reporting Services Save your report to the SSRS catalog and then click Run. Your rendered report should resemble the one shown in Figure 53.39. FIGURE 53.38 RB3 design surface with gauge report. Product: BK-R64Y-40 (Road-55-W) Reviewer: Laura Norman Review Date: 12/17/2007 Product: PD-M562 (HL Mountain Pedal) Reviewer: Jill Review Date: 12/17/2007 2.6 0 3.9 1.3 2.6 0 5 3.9 1.3 FIGURE 53.39 Rendered RB3 gauge report. ptg 2233 Developing Reports 53 Report Builder and Report Model Security Security is not limited to running reports in RB3. When you save a report to the catalog, users can access it through Report Manager. A user who has permissions to view a report but doesn’t have permissions to one of its fields simply will not see that column when running the report. This powerful feature is called column subsetting and is specific to reports using RMs. Several resources are independently secured when you run reports in the Report Server: . You can secure the report itself, by setting permissions on the report or inheriting permissions from the parent folder or the parent’s parent, and so on, all the way up to the Report Server root folder. . You can secure the model in the Report Server; this is similar to the way reports are secured. If a certain user is not granted permissions to a model, he or she can’t see the model when RB3 starts and can’t build or run reports based on it. . You can secure the items in the model—for example, entities, fields, and relation- ships—in addition to securing the model itself. Keep in mind the following security override rules for models: . If a certain user has permissions to manage the model, this overrides the permissions set for any model items in the report. For instance, if Bob is given content manager permissions on a model, Bob sees all entities and fields in that model, regardless of the security set for model items. . Local administrators on the Report Server machine have special permissions in SSRS: they can view and change security for any resource stored in the Report Server. Enabling Report Builder RB3 relies on having a Report Server available. It uses the Report Server to load data models, run reports, and save and load them from the server. On the other hand, like all the other SQL Server 2008 services, SSRS is locked down by default. The following sections describe the changes you need to make to enable RB3 functionality. Granting Execute Report Definitions: A Global Permission To start, launch Report Manager, go to Site Settings, and click the Security link on the left of the page. The list of permissions that appears contains pairs of Windows users or groups and Report Server security roles. (A security role is a collection of permissions.) Click New Role Assignment and add your user or group to the System User role. This permission is required to run reports in RB3. Setting Model Permissions To run reports against a model, users need Browser permissions to that model. To set permissions, in Report Manager, locate your model, click the Security link on the hover menu, click Edit Item Security, click OK on the confirmation dialog, and add your server principal to the Browser role. . available. It uses the Report Server to load data models, run reports, and save and load them from the server. On the other hand, like all the other SQL Server 2008 services, SSRS is locked down. then click Next. Choose a color theme and then click Finish. Change the ptg 2226 CHAPTER 53 SQL Server 2008 Reporting Services title text for your map using the designer surface and then run your. we have variation attributes for the parent Sell Start Date attribute, ptg 2228 CHAPTER 53 SQL Server 2008 Reporting Services including Start Sell Day, Start Sell Year, Start Sell Month, and Start