- Page 2 and 3:
Programmer to Programmer Get more
- Page 5:
Beginning Microsoft SQL Ser ver® 2
- Page 8 and 9:
Beginning Microsoft SQL Ser ver® 2
- Page 11:
About the Author Experiencing his f
- Page 15:
Acknowledgments Over the years, the
- Page 18 and 19:
Contents Chapter 2:T ools of the T
- Page 20 and 21:
Contents xviii The CREATE Statement
- Page 22 and 23:
Contents xx Correlated Subqueries 1
- Page 24 and 25:
Contents xxii SORT_IN_TEMPDB 280 ON
- Page 26 and 27:
Contents xxiv Control-of-Flow State
- Page 28 and 29:
Contents xxvi How the SQL Ser ver L
- Page 30 and 31:
Contents Chapter 16: A Brief XML Pr
- Page 32 and 33:
Contents Chapter 19: Pla ying Admin
- Page 34 and 35:
Introduction The beginning user wil
- Page 36 and 37:
Introduction ❏ We show file names
- Page 38 and 39:
Introduction xxxvi ❏ Understand t
- Page 40 and 41:
Chapter 1: RDBMS Basics: What Makes
- Page 42 and 43:
Chapter 1: RDBMS Basics: What Makes
- Page 44 and 45:
Chapter 1: RDBMS Basics: What Makes
- Page 46 and 47:
Chapter 1: RDBMS Basics: What Makes
- Page 48 and 49:
Chapter 1: RDBMS Basics: What Makes
- Page 50 and 51:
Chapter 1: RDBMS Basics: What Makes
- Page 52 and 53:
Chapter 1: RDBMS Basics: What Makes
- Page 54 and 55:
Chapter 1: RDBMS Basics: What Makes
- Page 56 and 57:
Chapter 1: RDBMS Basics: What Makes
- Page 58 and 59:
Chapter 1: RDBMS Basics: What Makes
- Page 60 and 61: Chapter 2: Tools of the Trade 22 My
- Page 62 and 63: Chapter 2: Tools of the Trade ❑ S
- Page 64 and 65: Chapter 2: Tools of the Trade 26 Ke
- Page 66 and 67: Chapter 2: Tools of the Trade 28 Th
- Page 68 and 69: Chapter 2: Tools of the Trade 30 lo
- Page 70 and 71: Chapter 2: Tools of the Trade 32 3.
- Page 72 and 73: Chapter 2: Tools of the Trade 34 Fi
- Page 74 and 75: Chapter 2: Tools of the Trade Figur
- Page 76 and 77: Chapter 2: Tools of the Trade Note
- Page 78 and 79: Chapter 2: Tools of the Trade bcp i
- Page 81 and 82: 3 The Foundation Statements of T-SQ
- Page 83 and 84: asic SELECT statement. Fire up the
- Page 85 and 86: Now let’s try taking a little bit
- Page 87 and 88: very few of your tables will have s
- Page 89 and 90: Operator Example Usage Effect ALL,
- Page 91 and 92: Chapter 3: The Foundation Statement
- Page 93 and 94: WHERE SalesOrderID IN (43660, 43670
- Page 95 and 96: AVG This one is for computing avera
- Page 97 and 98: efore, but remove the two AS keywor
- Page 99 and 100: You’ll get a result that is a bit
- Page 101 and 102: What if we want to place conditions
- Page 103 and 104: Let’s say, for example, that we w
- Page 105 and 106: Chapter 3: The Foundation Statement
- Page 107 and 108: City varchar(20) NOT NULL, State ch
- Page 109: for it in the INSERT statement. For
- Page 113 and 114: Chapter 3: The Foundation Statement
- Page 115 and 116: Chapter 3: The Foundation Statement
- Page 117: Chapter 3: The Foundation Statement
- Page 120 and 121: Chapter 4: JOINs 82 returned is in
- Page 122 and 123: Chapter 4: JOINs 84 Using an INNER
- Page 124 and 125: Chapter 4: JOINs 86 Uh, oh — this
- Page 126 and 127: Chapter 4: JOINs How It Works Unlik
- Page 128 and 129: Chapter 4: JOINs If we were to look
- Page 130 and 131: Chapter 4: JOINs 92 What I’m tryi
- Page 132 and 133: Chapter 4: JOINs 16 Mountain-500 Si
- Page 134 and 135: Chapter 4: JOINs 96 Let’s use thi
- Page 136 and 137: Chapter 4: JOINs 98 vendor. We’re
- Page 138 and 139: Chapter 4: JOINs 100 Somehow, we lo
- Page 140 and 141: Chapter 4: JOINs Try It Out FULL JO
- Page 142 and 143: Chapter 4: JOINs Every time I teach
- Page 144 and 145: Chapter 4: JOINs JOIN Sales.Special
- Page 146 and 147: Chapter 4: JOINs Figure 4-1 As alwa
- Page 148 and 149: Chapter 4: JOINs 110 CREATE TABLE U
- Page 150 and 151: Chapter 4: JOINs There are two diff
- Page 152 and 153: Chapter 5: Creating and Altering Ta
- Page 154 and 155: Chapter 5: Creating and Altering Ta
- Page 156 and 157: Chapter 5: Creating and Altering Ta
- Page 158 and 159: Chapter 5: Creating and Altering Ta
- Page 160 and 161:
Chapter 5: Creating and Altering Ta
- Page 162 and 163:
Chapter 5: Creating and Altering Ta
- Page 164 and 165:
Chapter 5: Creating and Altering Ta
- Page 166 and 167:
Chapter 5: Creating and Altering Ta
- Page 168 and 169:
Chapter 5: Creating and Altering Ta
- Page 170 and 171:
Chapter 5: Creating and Altering Ta
- Page 172 and 173:
Chapter 5: Creating and Altering Ta
- Page 174 and 175:
Chapter 5: Creating and Altering Ta
- Page 176 and 177:
Chapter 5: Creating and Altering Ta
- Page 178 and 179:
Chapter 5: Creating and Altering Ta
- Page 180 and 181:
Chapter 5: Creating and Altering Ta
- Page 182 and 183:
Chapter 5: Creating and Altering Ta
- Page 184 and 185:
Chapter 5: Creating and Altering Ta
- Page 186 and 187:
Chapter 5: Creating and Altering Ta
- Page 188 and 189:
Chapter 5: Creating and Altering Ta
- Page 190 and 191:
Chapter 5: Creating and Altering Ta
- Page 192 and 193:
Chapter 6: Constraints At a more sp
- Page 194 and 195:
Chapter 6: Constraints We can then
- Page 196 and 197:
Chapter 6: Constraints A table can
- Page 198 and 199:
Chapter 6: Constraints FOREIGN KEY
- Page 200 and 201:
Chapter 6: Constraints How It Works
- Page 202 and 203:
Chapter 6: Constraints Cascading Ac
- Page 204 and 205:
Chapter 6: Constraints 166 This is
- Page 206 and 207:
Chapter 6: Constraints 168 FROM Ord
- Page 208 and 209:
Chapter 6: Constraints 170 Let’s
- Page 210 and 211:
Chapter 6: Constraints CHECK Constr
- Page 212 and 213:
Chapter 6: Constraints Defining a D
- Page 214 and 215:
Chapter 6: Constraints Ignoring Bad
- Page 216 and 217:
Chapter 6: Constraints Try running
- Page 218 and 219:
Chapter 6: Constraints Rules and De
- Page 220 and 221:
Chapter 6: Constraints Dropping Rul
- Page 222 and 223:
Chapter 6: Constraints 184 Restrict
- Page 225 and 226:
7 Adding More to Our Queries When I
- Page 227 and 228:
Building a Nested Subquery A nested
- Page 229 and 230:
While this works just fine, queries
- Page 231 and 232:
We’ll go back to the AdventureWor
- Page 233 and 234:
❑ Aliases are used in both querie
- Page 235 and 236:
Now let’s see this at work in our
- Page 237 and 238:
So let’s take this now and apply
- Page 239 and 240:
This join-based syntax, for example
- Page 241 and 242:
IF NOT EXISTS (SELECT ‘True’ FR
- Page 243 and 244:
The conversions can actually get a
- Page 245 and 246:
there are no other roll up records
- Page 247 and 248:
GROUP BY soh.OrderDate, sod.Product
- Page 249 and 250:
OUTPUT $action, inserted.Year, inse
- Page 251 and 252:
The long-standing, traditional view
- Page 253 and 254:
8 Being Normal: Normalization and O
- Page 255 and 256:
Chapter 8: Being Normal: Normalizat
- Page 257 and 258:
Chapter 8: Being Normal: Normalizat
- Page 259 and 260:
Chapter 8: Being Normal: Normalizat
- Page 261 and 262:
Chapter 8: Being Normal: Normalizat
- Page 263 and 264:
Chapter 8: Being Normal: Normalizat
- Page 265 and 266:
Chapter 8: Being Normal: Normalizat
- Page 267 and 268:
Chapter 8: Being Normal: Normalizat
- Page 269 and 270:
Chapter 8: Being Normal: Normalizat
- Page 271 and 272:
Chapter 8: Being Normal: Normalizat
- Page 273 and 274:
Chapter 8: Being Normal: Normalizat
- Page 275 and 276:
Chapter 8: Being Normal: Normalizat
- Page 277 and 278:
Chapter 8: Being Normal: Normalizat
- Page 279 and 280:
Chapter 8: Being Normal: Normalizat
- Page 281 and 282:
Chapter 8: Being Normal: Normalizat
- Page 283 and 284:
Chapter 8: Being Normal: Normalizat
- Page 285 and 286:
Chapter 8: Being Normal: Normalizat
- Page 287 and 288:
Chapter 8: Being Normal: Normalizat
- Page 289 and 290:
Chapter 8: Being Normal: Normalizat
- Page 291 and 292:
Chapter 8: Being Normal: Normalizat
- Page 293 and 294:
Chapter 8: Being Normal: Normalizat
- Page 295 and 296:
Chapter 8: Being Normal: Normalizat
- Page 297 and 298:
Chapter 8: Being Normal: Normalizat
- Page 299 and 300:
9 SQL Ser ver Storage and Index Str
- Page 301 and 302:
Page Splits When a page becomes ful
- Page 303 and 304:
The point here is that what happens
- Page 305 and 306:
Page Splits — A First Look All of
- Page 307 and 308:
You may hear lots of bad things abo
- Page 309 and 310:
Navigating the Tree Figure 9-4 As I
- Page 311 and 312:
there was no link between the data.
- Page 313 and 314:
Root Non-Leaf Level Leaf Level Figu
- Page 315 and 316:
The CREATE INDEX Statement The CREA
- Page 317 and 318:
FILLFACTOR When SQL Server first cr
- Page 319 and 320:
works only if tempdb is on a separa
- Page 321 and 322:
Secondary XML Indexes Chapter 9: SQ
- Page 323 and 324:
occur, and that one or more non-lea
- Page 325 and 326:
isn’t room on the page, SQL Serve
- Page 327 and 328:
more administrator oriented and usu
- Page 329 and 330:
The Database Engine Tuning Advisor
- Page 331 and 332:
The output is far more self-describ
- Page 333 and 334:
We use a FILLFACTOR when we need to
- Page 335:
Chapter 9: SQL Server Storage and I
- Page 338 and 339:
Chapter 10: Views The preceding syn
- Page 340 and 341:
Chapter 10: Views 302 columns to a
- Page 342 and 343:
Chapter 10: Views Try It Out Using
- Page 344 and 345:
Chapter 10: Views 306 soh.SalesOrde
- Page 346 and 347:
Chapter 10: Views AW00000676 43659
- Page 348 and 349:
Chapter 10: Views NULL values will
- Page 350 and 351:
Chapter 10: Views Editing V iews wi
- Page 352 and 353:
Chapter 10: Views 314 There are fou
- Page 354 and 355:
Chapter 10: Views Editing Views in
- Page 356 and 357:
Chapter 10: Views 318 In addition,
- Page 358 and 359:
Chapter 10: Views 320 from the firs
- Page 360 and 361:
Chapter 10: Views You can get the y
- Page 363 and 364:
11 Writing Scripts and Batches Whet
- Page 365 and 366:
Next we have a DECLARE statement to
- Page 367 and 368:
I’m not going to pick any bones a
- Page 369 and 370:
Using @@IDENTITY @@IDENTITY is one
- Page 371 and 372:
How It Works What we’re doing in
- Page 373 and 374:
DECLARE @RowCount int; --Notice the
- Page 375 and 376:
When the editing tool encounters a
- Page 377 and 378:
When you think about it, this seems
- Page 379 and 380:
So, let’s try a quick query direc
- Page 381 and 382:
We now have our text file source fo
- Page 383 and 384:
Let’s build an example in the Adv
- Page 385 and 386:
DECLARE @InVar varchar(50); DECLARE
- Page 387 and 388:
-- This won’t work DECLARE @Numbe
- Page 389 and 390:
-- Now we’re run our conditional
- Page 391 and 392:
Out of the condition from inner con
- Page 393 and 394:
A Simple CASE A simple CASE takes a
- Page 395 and 396:
3 8 More Than One Apart 2 2 Ends Wi
- Page 397 and 398:
Now, I don’t know about you, but
- Page 399 and 400:
The WAITFOR statement does exactly
- Page 401 and 402:
IF @ErrorNo = 2714 -- Object exists
- Page 403:
Chapter 11: Writing Scripts and Bat
- Page 406 and 407:
Chapter 12: Stored Procedures Creat
- Page 408 and 409:
Chapter 12: Stored Procedures Dropp
- Page 410 and 411:
Chapter 12: Stored Procedures Suppl
- Page 412 and 413:
Chapter 12: Stored Procedures 374 [
- Page 414 and 415:
Chapter 12: Stored Procedures Confi
- Page 416 and 417:
Chapter 12: Stored Procedures Now,
- Page 418 and 419:
Chapter 12: Stored Procedures SQL S
- Page 420 and 421:
Chapter 12: Stored Procedures 382 c
- Page 422 and 423:
Chapter 12: Stored Procedures It wo
- Page 424 and 425:
Chapter 12: Stored Procedures 386 r
- Page 426 and 427:
Chapter 12: Stored Procedures 388 -
- Page 428 and 429:
Chapter 12: Stored Procedures Note
- Page 430 and 431:
Chapter 12: Stored Procedures 392 n
- Page 432 and 433:
Chapter 12: Stored Procedures All t
- Page 434 and 435:
Chapter 12: Stored Procedures Sproc
- Page 436 and 437:
Chapter 12: Stored Procedures When
- Page 438 and 439:
Chapter 12: Stored Procedures 400 @
- Page 440 and 441:
Chapter 12: Stored Procedures I’d
- Page 442 and 443:
Chapter 12: Stored Procedures match
- Page 444 and 445:
Chapter 12: Stored Procedures There
- Page 446 and 447:
Chapter 12: Stored Procedures 408 f
- Page 449 and 450:
13 User-Defined Functions Well, her
- Page 451 and 452:
types!), except for BLOBs, cursors,
- Page 453 and 454:
We get back the same set as with th
- Page 455 and 456:
AS RETURN (SELECT BusinessEntityID,
- Page 457 and 458:
in your relational database. These
- Page 459 and 460:
AS BEGIN ( EmployeeID int NOT NULL,
- Page 461 and 462:
So, as you can see, we can actually
- Page 463 and 464:
Despite being schema-bound, this on
- Page 465 and 466:
14 Transactions and Locks This is o
- Page 467 and 468:
we are unable or do not want to com
- Page 469 and 470:
Figure 14-1 Data needed Data in cac
- Page 471 and 472:
Transaction 4 This transaction wasn
- Page 473 and 474:
Oops — problem!!! Transaction 2 h
- Page 475 and 476:
The only cure for this is setting y
- Page 477 and 478:
Exclusive Locks Exclusive locks are
- Page 479 and 480:
Also: ❑ The Sch-S is compatible w
- Page 481 and 482:
The syntax for switching between th
- Page 483 and 484:
As with most things in life, howeve
- Page 485 and 486:
purchased. Process 2 records sales;
- Page 487:
Chapter 14: Transactions and Locks
- Page 490 and 491:
Chapter 15: Triggers the world’s
- Page 492 and 493:
Chapter 15: Triggers WITH ENCRYPTIO
- Page 494 and 495:
Chapter 15: Triggers FOR|AFTER The
- Page 496 and 497:
Chapter 15: Triggers 458 To illustr
- Page 498 and 499:
Chapter 15: Triggers 460 IF EXISTS
- Page 500 and 501:
Chapter 15: Triggers ❑ Feeding de
- Page 502 and 503:
Chapter 15: Triggers Trigger Firing
- Page 504 and 505:
Chapter 15: Triggers Like regular t
- Page 506 and 507:
Chapter 15: Triggers The COLUMNS_UP
- Page 508 and 509:
Chapter 15: Triggers This is the sa
- Page 510 and 511:
Chapter 15: Triggers 472 we have th
- Page 512 and 513:
Chapter 16: A Brief XML Primer So,
- Page 514 and 515:
Chapter 16: A Brief XML Primer Figu
- Page 516 and 517:
Chapter 16: A Brief XML Primer Elem
- Page 518 and 519:
Chapter 16: A Brief XML Primer ❑
- Page 520 and 521:
Chapter 16: A Brief XML Primer 482
- Page 522 and 523:
Chapter 16: A Brief XML Primer Name
- Page 524 and 525:
Chapter 16: A Brief XML Primer The
- Page 526 and 527:
Chapter 16: A Brief XML Primer 2. W
- Page 528 and 529:
Chapter 16: A Brief XML Primer SQL
- Page 530 and 531:
Chapter 16: A Brief XML Primer So,
- Page 532 and 533:
Chapter 16: A Brief XML Primer If,
- Page 534 and 535:
Chapter 16: A Brief XML Primer 496
- Page 536 and 537:
Chapter 16: A Brief XML Primer Note
- Page 538 and 539:
Chapter 16: A Brief XML Primer RAW
- Page 540 and 541:
Chapter 16: A Brief XML Primer AUTO
- Page 542 and 543:
Chapter 16: A Brief XML Primer EXPL
- Page 544 and 545:
Chapter 16: A Brief XML Primer Chec
- Page 546 and 547:
Chapter 16: A Brief XML Primer 508
- Page 548 and 549:
Chapter 16: A Brief XML Primer 510
- Page 550 and 551:
Chapter 16: A Brief XML Primer 512
- Page 552 and 553:
Chapter 16: A Brief XML Primer The
- Page 554 and 555:
Chapter 16: A Brief XML Primer 516
- Page 556 and 557:
Chapter 17: Reporting for Duty, Sir
- Page 558 and 559:
Chapter 17: Reporting for Duty, Sir
- Page 560 and 561:
Chapter 17: Reporting for Duty, Sir
- Page 562 and 563:
Chapter 17: Reporting for Duty, Sir
- Page 564 and 565:
Chapter 17: Reporting for Duty, Sir
- Page 566 and 567:
Chapter 17: Reporting for Duty, Sir
- Page 568 and 569:
Chapter 17: Reporting for Duty, Sir
- Page 570 and 571:
Chapter 17: Reporting for Duty, Sir
- Page 572 and 573:
Chapter 17: Reporting for Duty, Sir
- Page 574 and 575:
Chapter 17: Reporting for Duty, Sir
- Page 576 and 577:
Chapter 17: Reporting for Duty, Sir
- Page 578 and 579:
Chapter 17: Reporting for Duty, Sir
- Page 580 and 581:
Chapter 17: Reporting for Duty, Sir
- Page 582 and 583:
Chapter 18: Getting Integrated with
- Page 584 and 585:
Chapter 18: Getting Integrated with
- Page 586 and 587:
Chapter 18: Getting Integrated with
- Page 588 and 589:
Chapter 18: Getting Integrated with
- Page 590 and 591:
Chapter 18: Getting Integrated with
- Page 592 and 593:
Chapter 18: Getting Integrated with
- Page 594 and 595:
Chapter 18: Getting Integrated with
- Page 596 and 597:
Chapter 18: Getting Integrated with
- Page 598 and 599:
Chapter 18: Getting Integrated with
- Page 601 and 602:
19 Playing Administrator And so, he
- Page 603 and 604:
❑ Write the information to the ev
- Page 605 and 606:
Creating Jobs and Tasks Using Manag
- Page 607 and 608:
Let’s go ahead and move on to the
- Page 609 and 610:
Figure 19-8 Figure 19-9 Chapter 19:
- Page 611 and 612:
Figure 19-11 Figure 19-12 Chapter 1
- Page 613 and 614:
Backup and Reco very No database-dr
- Page 615 and 616:
❑ Differential: This might be ref
- Page 617 and 618:
❑ Simple: Under this model, the t
- Page 619 and 620:
The older DBCC commands are still s
- Page 621 and 622:
many rows inserted over time and th
- Page 623:
Chapter 19: Playing Administrator T
- Page 626 and 627:
Appendix A: System Functions In add
- Page 628 and 629:
Appendix A: System Functions @@TOTA
- Page 630 and 631:
Appendix A: System Functions CHECKS
- Page 632 and 633:
Appendix A: System Functions SUM Th
- Page 634 and 635:
Appendix A: System Functions The de
- Page 636 and 637:
Appendix A: System Functions @@REMS
- Page 638 and 639:
Appendix A: System Functions Cert_I
- Page 640 and 641:
Appendix A: System Functions Encryp
- Page 642 and 643:
Appendix A: System Functions @@FETC
- Page 644 and 645:
Appendix A: System Functions CURREN
- Page 646 and 647:
Appendix A: System Functions SYSDAT
- Page 648 and 649:
Appendix A: System Functions GetRoo
- Page 650 and 651:
Appendix A: System Functions The ex
- Page 652 and 653:
Appendix A: System Functions RAND T
- Page 654 and 655:
Appendix A: System Functions ❑ IN
- Page 656 and 657:
Appendix A: System Functions ❑ Is
- Page 658 and 659:
Appendix A: System Functions FILEGR
- Page 660 and 661:
Appendix A: System Functions INDEX_
- Page 662 and 663:
IsCheckCnst IsConstraint IsDefault
- Page 664 and 665:
Appendix A: System Functions OBJECT
- Page 666 and 667:
Appendix A: System Functions TYPEPR
- Page 668 and 669:
Appendix A: System Functions The qu
- Page 670 and 671:
Appendix A: System Functions The SU
- Page 672 and 673:
Appendix A: System Functions ASCII
- Page 674 and 675:
Appendix A: System Functions The ch
- Page 676 and 677:
Appendix A: System Functions UNICOD
- Page 678 and 679:
Appendix A: System Functions CAST a
- Page 680 and 681:
Appendix A: System Functions HOST_I
- Page 682 and 683:
Appendix A: System Functions NULLIF
- Page 684 and 685:
Appendix A: System Functions 646 Pr
- Page 686 and 687:
Appendix A: System Functions Text a
- Page 688 and 689:
Appendix B: Very Simple Connectivit
- Page 690 and 691:
Appendix B: Very Simple Connectivit
- Page 692 and 693:
Appendix B: Very Simple Connectivit
- Page 694 and 695:
Appendix B: Very Simple Connectivit
- Page 696 and 697:
ABS function A ABS function, 611 AC
- Page 698 and 699:
closing tags closing tags, XML docu
- Page 700 and 701:
cryptographic functions (continued)
- Page 702 and 703:
defects defects. See well formed XM
- Page 704 and 705:
EXPLICIT option EXPLICIT option bas
- Page 706 and 707:
IGNORE_DUP_KEY option (CREATE INDEX
- Page 708 and 709:
LOWER function LOWER function, 635
- Page 710 and 711:
online transaction-processing (OLTP
- Page 712 and 713:
query results query results alphabe
- Page 714 and 715:
scripts (continued) creating with M
- Page 716 and 717:
state state, basics of, 391 stateme
- Page 718 and 719:
transactions (continued) COMMIT TRA
- Page 720:
View Builder View Builder (Manageme