| Acknowledgments |
|
xix | |
| Introduction |
|
xxi | |
|
Part I SQL Server: Basic Concepts |
|
|
|
Database Systems and SQL Server |
|
|
3 | (20) |
|
Database Systems: An Overview |
|
|
6 | (3) |
|
Variety of User Interfaces |
|
|
7 | (1) |
|
Physical Data Independence |
|
|
7 | (1) |
|
Logical Data Independence |
|
|
7 | (1) |
|
|
|
7 | (1) |
|
|
|
8 | (1) |
|
|
|
8 | (1) |
|
|
|
8 | (1) |
|
Security and Authorization |
|
|
9 | (1) |
|
Relational Database Systems |
|
|
9 | (3) |
|
Working with the Book's Sample Database |
|
|
9 | (3) |
|
SQL: A Relational Database Language |
|
|
12 | (2) |
|
|
|
14 | (1) |
|
|
|
14 | (6) |
|
|
|
16 | (2) |
|
Entity-Relationship (ER) Model |
|
|
18 | (2) |
|
|
|
20 | (1) |
|
Overview of Microsoft SQL Server |
|
|
20 | (1) |
|
|
|
21 | (2) |
|
SQL Server Management Studio |
|
|
23 | (26) |
|
The SQL Server Program Group and Books Online |
|
|
24 | (1) |
|
Introduction to SQL Server Management Studio |
|
|
25 | (19) |
|
Using Management Studio with the SQL Server Database Engine |
|
|
28 | (4) |
|
Managing Databases Using Object Explorer |
|
|
32 | (7) |
|
Authoring Activities Using SQL Server Management Studio |
|
|
39 | (5) |
|
|
|
44 | (1) |
|
|
|
44 | (5) |
|
Part II Transact-SQL Language |
|
|
|
|
|
49 | (24) |
|
|
|
50 | (3) |
|
|
|
52 | (1) |
|
|
|
52 | (1) |
|
|
|
52 | (1) |
|
|
|
53 | (6) |
|
|
|
53 | (1) |
|
|
|
54 | (2) |
|
|
|
56 | (1) |
|
|
|
57 | (1) |
|
|
|
58 | (1) |
|
|
|
59 | (1) |
|
|
|
59 | (1) |
|
|
|
60 | (1) |
|
|
|
60 | (7) |
|
|
|
61 | (1) |
|
|
|
62 | (1) |
|
|
|
63 | (2) |
|
|
|
65 | (1) |
|
|
|
65 | (2) |
|
|
|
67 | (2) |
|
|
|
68 | (1) |
|
|
|
69 | (1) |
|
|
|
70 | (1) |
|
|
|
71 | (2) |
|
|
|
73 | (38) |
|
Creating Database Objects |
|
|
74 | (24) |
|
|
|
74 | (4) |
|
Create Table: A Basic Form |
|
|
78 | (2) |
|
Create Table: The Enhanced Form |
|
|
80 | (1) |
|
Create Table and Declarative Integrity Constraints |
|
|
81 | (5) |
|
|
|
86 | (5) |
|
Creating Other Database Objects |
|
|
91 | (2) |
|
Integrity Constraints and Domains |
|
|
93 | (5) |
|
Modifying Database Objects |
|
|
98 | (7) |
|
|
|
99 | (1) |
|
Altering a Table: A Basic Form |
|
|
100 | (2) |
|
Altering a Table: Enhanced Form |
|
|
102 | (3) |
|
Removing Database Objects |
|
|
105 | (1) |
|
|
|
106 | (1) |
|
|
|
106 | (5) |
|
|
|
111 | (58) |
|
Select Statement: A Basic Form |
|
|
112 | (2) |
|
|
|
114 | (17) |
|
|
|
117 | (5) |
|
|
|
122 | (3) |
|
Queries Involving Null Values |
|
|
125 | (2) |
|
|
|
127 | (4) |
|
|
|
131 | (8) |
|
Subqueries and Comparison Operators |
|
|
132 | (1) |
|
Subqueries and In Operator |
|
|
133 | (2) |
|
|
|
135 | (3) |
|
|
|
138 | (1) |
|
Queries in the From Clause |
|
|
138 | (1) |
|
|
|
139 | (2) |
|
|
|
141 | (8) |
|
|
|
141 | (6) |
|
|
|
147 | (1) |
|
Superaggregates (Operators Cube and Rollup) |
|
|
148 | (1) |
|
User-Defined Aggregate Functions |
|
|
148 | (1) |
|
|
|
149 | (1) |
|
|
|
150 | (2) |
|
Select Statement and Identity Property |
|
|
152 | (2) |
|
|
|
154 | (5) |
|
|
|
159 | (2) |
|
|
|
161 | (3) |
|
|
|
164 | (1) |
|
|
|
165 | (1) |
|
|
|
166 | (1) |
|
|
|
166 | (3) |
|
|
|
169 | (36) |
|
|
|
170 | (17) |
|
Two Syntax Forms to Implement Joins |
|
|
171 | (1) |
|
|
|
171 | (4) |
|
|
|
175 | (2) |
|
|
|
177 | (2) |
|
|
|
179 | (1) |
|
Joining More Than Two Tables |
|
|
180 | (2) |
|
Joining a Table with Itself |
|
|
182 | (2) |
|
|
|
184 | (3) |
|
|
|
187 | (6) |
|
Exists Function and Subqueries |
|
|
189 | (4) |
|
Should You Use Join or Subqueries? |
|
|
193 | (2) |
|
|
|
193 | (1) |
|
|
|
194 | (1) |
|
|
|
195 | (7) |
|
CTE and Nonrecursive Queries |
|
|
195 | (2) |
|
Common Table Expressions and Recursive Queries |
|
|
197 | (5) |
|
|
|
202 | (1) |
|
|
|
203 | (2) |
|
Modification of a Table's Contents |
|
|
205 | (12) |
|
|
|
206 | (4) |
|
|
|
206 | (3) |
|
|
|
209 | (1) |
|
|
|
210 | (3) |
|
|
|
213 | (2) |
|
|
|
215 | (1) |
|
|
|
216 | (1) |
|
Stored Procedures and User-Defined Functions |
|
|
217 | (28) |
|
|
|
218 | (7) |
|
|
|
218 | (1) |
|
|
|
219 | (1) |
|
|
|
220 | (1) |
|
|
|
221 | (1) |
|
Miscellaneous Procedural Statements |
|
|
222 | (1) |
|
Handling Events With Try and Catch Statements |
|
|
223 | (2) |
|
|
|
225 | (12) |
|
Creation and Execution of Stored Procedures |
|
|
226 | (5) |
|
|
|
231 | (1) |
|
Stored Procedures and CLR |
|
|
231 | (6) |
|
|
|
237 | (6) |
|
Creation and Execution of User-Defined Functions |
|
|
237 | (4) |
|
User-Defined Functions and CLR |
|
|
241 | (2) |
|
|
|
243 | (1) |
|
|
|
243 | (2) |
|
Indices and Query Optimization |
|
|
245 | (38) |
|
|
|
246 | (14) |
|
Clustered and Nonclustered Indices |
|
|
248 | (2) |
|
Indices and the Corresponding Transact-SQL Statements |
|
|
250 | (6) |
|
Editing Index Information |
|
|
256 | (1) |
|
|
|
257 | (1) |
|
Guidelines for Creating Indices |
|
|
258 | (2) |
|
General Criteria to Improve Efficiency |
|
|
260 | (5) |
|
Join vs. Correlated Subquery |
|
|
260 | (1) |
|
|
|
261 | (1) |
|
|
|
261 | (1) |
|
Transact-SQL Statements for Query Optimization |
|
|
262 | (3) |
|
|
|
265 | (13) |
|
|
|
265 | (2) |
|
Implementing the Join Operation |
|
|
267 | (1) |
|
|
|
268 | (10) |
|
The DBCC Command and Indices |
|
|
278 | (2) |
|
|
|
280 | (1) |
|
|
|
280 | (3) |
|
|
|
283 | (24) |
|
|
|
284 | (7) |
|
|
|
285 | (4) |
|
Altering and Removing Views |
|
|
289 | (2) |
|
|
|
291 | (7) |
|
|
|
291 | (1) |
|
Insert Statement and a View |
|
|
292 | (3) |
|
Update Statement and a View |
|
|
295 | (2) |
|
Delete Statement and a View |
|
|
297 | (1) |
|
|
|
298 | (7) |
|
|
|
299 | (3) |
|
Benefits of Indexed Views |
|
|
302 | (1) |
|
|
|
303 | (2) |
|
|
|
305 | (1) |
|
|
|
305 | (2) |
|
|
|
307 | (18) |
|
|
|
308 | (3) |
|
|
|
308 | (1) |
|
|
|
309 | (1) |
|
|
|
309 | (1) |
|
|
|
310 | (1) |
|
|
|
310 | (1) |
|
|
|
310 | (1) |
|
|
|
311 | (1) |
|
|
|
311 | (2) |
|
|
|
312 | (1) |
|
|
|
313 | (1) |
|
|
|
313 | (1) |
|
|
|
313 | (2) |
|
Other Ways to Access System Information |
|
|
315 | (8) |
|
|
|
316 | (2) |
|
|
|
318 | (2) |
|
|
|
320 | (1) |
|
|
|
320 | (3) |
|
|
|
323 | (1) |
|
|
|
324 | (1) |
|
|
|
325 | (40) |
|
|
|
326 | (6) |
|
SQL Server Encryption Policy and Mechanisms |
|
|
327 | (2) |
|
Setting Up SQL Server Security Using DDL |
|
|
329 | (2) |
|
Setting Up SQL Server Security Using System Procedures |
|
|
331 | (1) |
|
System Procedures Concerning Logins |
|
|
331 | (1) |
|
|
|
332 | (4) |
|
|
|
333 | (1) |
|
DDL Statements Concerning Schema |
|
|
334 | (2) |
|
|
|
336 | (4) |
|
Setting Up Database User Accounts with DDL |
|
|
336 | (2) |
|
Setting Up Database User Accounts Using System Procedures |
|
|
338 | (1) |
|
|
|
339 | (1) |
|
|
|
340 | (11) |
|
|
|
340 | (1) |
|
Fixed Server Roles and Their Permissions |
|
|
341 | (2) |
|
|
|
343 | (1) |
|
Fixed Database Roles and Their Permissions |
|
|
344 | (2) |
|
|
|
346 | (3) |
|
User-Defined Database Roles |
|
|
349 | (2) |
|
|
|
351 | (8) |
|
|
|
351 | (6) |
|
|
|
357 | (1) |
|
|
|
358 | (1) |
|
|
|
359 | (1) |
|
Stored Procedures and Data Access |
|
|
360 | (1) |
|
|
|
361 | (1) |
|
|
|
362 | (3) |
|
|
|
365 | (20) |
|
|
|
366 | (1) |
|
|
|
366 | (10) |
|
Application Areas for After Triggers |
|
|
369 | (4) |
|
Application Areas for Instead of Triggers |
|
|
373 | (1) |
|
|
|
374 | (1) |
|
|
|
375 | (1) |
|
|
|
376 | (5) |
|
|
|
381 | (2) |
|
Modifying Trigger's Structure |
|
|
383 | (1) |
|
|
|
383 | (1) |
|
|
|
384 | (1) |
|
|
|
385 | (20) |
|
|
|
386 | (1) |
|
Transact-SQL Statements and Transactions |
|
|
387 | (4) |
|
|
|
391 | (1) |
|
|
|
391 | (6) |
|
|
|
392 | (1) |
|
|
|
393 | (3) |
|
The Select Statement and Locking |
|
|
396 | (1) |
|
|
|
397 | (4) |
|
Row Versioning and Snapshot Isolation Level |
|
|
399 | (2) |
|
|
|
401 | (1) |
|
|
|
402 | (1) |
|
|
|
402 | (3) |
|
SQL Server System Environment |
|
|
405 | (22) |
|
|
|
406 | (4) |
|
|
|
407 | (3) |
|
|
|
410 | (1) |
|
|
|
410 | (1) |
|
|
|
410 | (1) |
|
|
|
411 | (5) |
|
|
|
412 | (1) |
|
|
|
413 | (1) |
|
|
|
414 | (2) |
|
|
|
416 | (2) |
|
|
|
418 | (1) |
|
|
|
418 | (1) |
|
|
|
419 | (4) |
|
Multiprocessor Hardware Architectures |
|
|
420 | (1) |
|
Multithreading Architecture of SQL Server |
|
|
421 | (2) |
|
|
|
423 | (1) |
|
|
|
423 | (4) |
|
Part III SQL Server: System Administration |
|
|
|
Overview of System Administration |
|
|
427 | (6) |
|
|
|
428 | (3) |
|
MS SQL Server 2005 Program Group |
|
|
429 | (1) |
|
|
|
429 | (1) |
|
|
|
430 | (1) |
|
|
|
431 | (1) |
|
|
|
432 | (1) |
|
Planning the Installation and Installing SQL Server |
|
|
433 | (16) |
|
Planning the Installation |
|
|
434 | (3) |
|
|
|
434 | (1) |
|
Hardware and Software Requirements |
|
|
435 | (1) |
|
|
|
436 | (1) |
|
Installation Recommendations |
|
|
437 | (1) |
|
|
|
437 | (8) |
|
Beginning the Installation |
|
|
438 | (7) |
|
Configuring SQL Server After Installation |
|
|
445 | (1) |
|
Create Server Groups and Register the Server |
|
|
445 | (1) |
|
|
|
446 | (1) |
|
Starting and Stopping an Instance of SQL Server |
|
|
446 | (2) |
|
|
|
448 | (1) |
|
Managing Databases and Database Files |
|
|
449 | (12) |
|
|
|
450 | (2) |
|
|
|
451 | (1) |
|
|
|
452 | (6) |
|
|
|
452 | (1) |
|
Viewing and Modifying Database Options |
|
|
453 | (3) |
|
|
|
456 | (2) |
|
Managing Transaction Logs |
|
|
458 | (1) |
|
|
|
459 | (1) |
|
|
|
459 | (2) |
|
|
|
461 | (12) |
|
|
|
462 | (3) |
|
Implementing a Security Mode |
|
|
463 | (1) |
|
Managing SQL Server Logins |
|
|
464 | (1) |
|
Database Security Permissions |
|
|
465 | (3) |
|
|
|
465 | (3) |
|
|
|
468 | (3) |
|
|
|
471 | (1) |
|
|
|
471 | (2) |
|
|
|
473 | (34) |
|
|
|
474 | (1) |
|
Software and Hardware Failures |
|
|
474 | (1) |
|
|
|
475 | (1) |
|
|
|
475 | (3) |
|
|
|
476 | (1) |
|
|
|
476 | (1) |
|
|
|
476 | (2) |
|
|
|
478 | (1) |
|
|
|
478 | (13) |
|
Backup Using Management Studio |
|
|
478 | (4) |
|
Backup Using Transact-SQL Statements |
|
|
482 | (3) |
|
Which Databases to Back Up? |
|
|
485 | (1) |
|
Minimizing System Downtime |
|
|
486 | (3) |
|
|
|
489 | (2) |
|
|
|
491 | (13) |
|
|
|
491 | (1) |
|
|
|
492 | (9) |
|
|
|
501 | (2) |
|
|
|
503 | (1) |
|
|
|
504 | (1) |
|
|
|
504 | (3) |
|
Automating System Administration Tasks |
|
|
507 | (20) |
|
|
|
508 | (1) |
|
|
|
509 | (1) |
|
Running and Configuring SQL Server Agent |
|
|
510 | (1) |
|
Creating Jobs and Operators |
|
|
510 | (7) |
|
|
|
510 | (1) |
|
Creating a Job Using SQL Server Management Studio |
|
|
511 | (3) |
|
|
|
514 | (1) |
|
Creating Operators for Notification |
|
|
515 | (1) |
|
Viewing the Job History Log |
|
|
516 | (1) |
|
|
|
517 | (7) |
|
|
|
517 | (2) |
|
|
|
519 | (1) |
|
|
|
519 | (1) |
|
Defining Alerts to Handle SQL Server Errors |
|
|
520 | (3) |
|
Defining Alerts to Handle User-Defined Errors |
|
|
523 | (1) |
|
|
|
524 | (1) |
|
|
|
525 | (2) |
|
|
|
527 | (30) |
|
|
|
528 | (1) |
|
Factors that Affect Performance |
|
|
529 | (9) |
|
Database Applications and Performance |
|
|
529 | (2) |
|
The Database Server and Performance |
|
|
531 | (1) |
|
System Resources and Performance |
|
|
532 | (1) |
|
|
|
533 | (5) |
|
|
|
538 | (10) |
|
Application Performance Tools |
|
|
538 | (4) |
|
SQL Server-Specific Monitoring |
|
|
542 | (4) |
|
Tools for Monitoring System Resources |
|
|
546 | (2) |
|
|
|
548 | (9) |
|
|
|
548 | (1) |
|
Database Engine Tuning Advisor |
|
|
549 | (7) |
|
|
|
556 | (1) |
|
|
|
557 | (12) |
|
|
|
558 | (1) |
|
Ways to Partition Your Data |
|
|
559 | (1) |
|
Steps for Creating Partitioned Tables |
|
|
559 | (7) |
|
|
|
560 | (1) |
|
Determine Partitioning Key and Number of Partitions |
|
|
560 | (1) |
|
Create a Filegroup for Each Partition |
|
|
561 | (1) |
|
Create Partition Function and Partition Scheme |
|
|
562 | (3) |
|
|
|
565 | (1) |
|
Guidelines for Partitioning Tables and Indices |
|
|
566 | (1) |
|
|
|
566 | (3) |
|
|
|
569 | (20) |
|
|
|
570 | (2) |
|
Methods for Distributing Data |
|
|
570 | (2) |
|
SQL Server Replication---An Overview |
|
|
572 | (8) |
|
Publishers, Distributors, and Subscribers |
|
|
572 | (1) |
|
Publications and Articles |
|
|
573 | (2) |
|
|
|
575 | (3) |
|
|
|
578 | (2) |
|
|
|
580 | (4) |
|
Configuring the Distribution and Publication Servers |
|
|
580 | (1) |
|
|
|
581 | (2) |
|
Setting Up Subscription Servers |
|
|
583 | (1) |
|
|
|
584 | (1) |
|
|
|
585 | (4) |
|
Part IV Microsoft Analysis Services |
|
|
|
Data Warehousing: An Introduction |
|
|
589 | (16) |
|
Online Transaction Processing vs. Data Warehousing |
|
|
590 | (2) |
|
Online Transaction Processing |
|
|
590 | (1) |
|
|
|
591 | (1) |
|
Data Warehouses and Data Marts |
|
|
592 | (3) |
|
|
|
595 | (3) |
|
|
|
595 | (3) |
|
|
|
598 | (2) |
|
|
|
599 | (1) |
|
|
|
600 | (2) |
|
|
|
601 | (1) |
|
|
|
602 | (1) |
|
|
|
603 | (1) |
|
|
|
603 | (2) |
|
Microsoft Analysis Services |
|
|
605 | (16) |
|
|
|
607 | (5) |
|
Analysis Services and Cubes |
|
|
612 | (7) |
|
|
|
614 | (1) |
|
Designing Storage Aggregation and Processing the Cube |
|
|
615 | (3) |
|
|
|
618 | (1) |
|
|
|
619 | (2) |
|
Business Intelligence and SQL |
|
|
621 | (18) |
|
OLAP Extensions in Transact-SQL |
|
|
622 | (15) |
|
|
|
622 | (4) |
|
|
|
626 | (2) |
|
|
|
628 | (6) |
|
|
|
634 | (2) |
|
Pivot and Unpivot Operators |
|
|
636 | (1) |
|
|
|
637 | (2) |
|
Microsoft Reporting Services |
|
|
639 | (20) |
|
|
|
640 | (2) |
|
|
|
640 | (1) |
|
|
|
641 | (1) |
|
|
|
641 | (1) |
|
|
|
642 | (10) |
|
|
|
643 | (7) |
|
|
|
650 | (2) |
|
Processing and Managing Reports |
|
|
652 | (1) |
|
Accessing and Delivering Reports |
|
|
653 | (3) |
|
|
|
653 | (2) |
|
|
|
655 | (1) |
|
|
|
656 | (1) |
|
|
|
656 | (3) |
|
|
|
|
|
|
659 | (10) |
|
|
|
660 | (1) |
|
XML and Related Languages |
|
|
661 | (4) |
|
|
|
661 | (4) |
|
Document Type Definitions |
|
|
665 | (3) |
|
|
|
667 | (1) |
|
|
|
668 | (1) |
|
|
|
669 | (18) |
|
Storing XML in Relational Databases |
|
|
670 | (1) |
|
|
|
671 | (7) |
|
|
|
674 | (1) |
|
|
|
675 | (3) |
|
Constructing XML Documents Using the for XML Clause |
|
|
678 | (7) |
|
|
|
678 | (1) |
|
|
|
679 | (1) |
|
|
|
680 | (2) |
|
|
|
682 | (1) |
|
Specifying Directives with Different Modes |
|
|
683 | (2) |
|
|
|
685 | (1) |
|
|
|
686 | (1) |
| Index |
|
687 | |