| help | account  


The Guru's Guide to Transact-SQL
View Larger Image
Ken Henderson
Addison-Wesley, Paperback, Bk&CD edition, Published February 2000, 551 pages, ISBN 0201615762
List Price: $64.99
Our Price: $40.95
You Save: $24.04 (37% Off)


FREE Shipping on Orders over $40!*
Availability: Out-Of-Stock

Customer Reviews: 2     Average Customer Rating:

Write a Review and tell the world about this title!

People who purchase this book frequently purchase:

Books on similar topics, in best-seller order:Books from the same publisher, in best-seller order:

Since its introduction over a decade ago, the Microsoft SQL Server query language, Transact-SQL, has become increasingly popular and more powerful. The current version sports such advanced features as OLE Automation support, cross-platform querying facilities, and full-text search management.

This book is the consummate guide to Microsoft Transact-SQL. From data type nuances to complex statistical computations to the bevy of undocumented features in the language, The Guru's Guide to Transact-SQL imparts the knowledge you need to become a virtuoso of the language as quickly as possible.

In this book, you will find the information, explanations, and advice you need to master Transact-SQL and develop the best possible Transact-SQL code. Some 600 code examples not only illustrate important concepts and best practices, but also provide working Transact-SQL code that can be incorporated into your own real-world DBMS applications.

Your journey begins with an introduction explaining language fundamentals such as database and table creation, inserting and updating data, queries, joins, data presentation, and managing transactions. Moving on to more advanced topics, the journey continues with in-depth coverage of:

  • Transact-SQL performance tuning using tools such as Query Analyzer and Performance Monitor
  • Nuances of the various T-SQL data types
  • Complex statistical calculations such as medians, modes, and sliding aggregates
  • Run, sequence, and series identification and interrogation
  • Advanced Data Definition Language (DDL) and Data Management Language (DML) techniques
  • Stored procedure and trigger best practices and coding methods
  • Transaction management
  • Optimal cursor use and caveats to look out for
  • Full-text search
  • Hierarchies and arrays
  • Administrative Transact-SQL
  • OLE Automation
  • More than 100 undocumented commands and language features, including numerous unpublished DBCC command verbs, trace flags, stored procedures, and functions

Comprehensive, written in understandable terms, and full of practical information and examples, The Guru's Guide to Transact-SQL is an indispensable reference for anyone working with this database development language. The accompanying CD-ROM includes the complete set of code examples found in the book as well as a SQL programming environment that will speed the development of your own top-notch Transact-SQL code.

Table of Contents

Foreword xvi

Preface xvii

About the Sample Databases xviii
Results Abridged xviii
On Formality xviii
Acknowledgments xix

Chapter 1: Introductory Transact-SQL 1

Choosing a SQL Editor 2
Creating a Database 3
Creating Tables 3
Inserting Data 5
Updating Data 6
Deleting Data 7
Querying Data 7
Filtering Data 11
Grouping Data 18
Ordering Data 19
Column Aliases 20
Table Aliases 21
Managing Transactions 21
Summary 22

Chapter 2: Transact-SQL Data Type Nuances 23

Dates 23
Strings 34
Numerics 54
BLOBs 59
Bits 66
UNIQUEIDENTIFIER 67
Cursor Variables 68
Timestamps 73
Summary 75

Chapter 3: Missing Values 77

NULL and Expressions 78
NULL and Functions 78
NULL and ANSI SQL 79
NULL and Stored Procedures 81
NULL If You Must 83

Chapter 4: DDL Insights 85

CREATE TABLE 86
Dropping Objects 89
CREATE INDEX 90
TEMPORARY OBJECTS 91
Object Naming and Dependencies 93
Summary 95

Chapter 5: DML Insights 97

INSERT 97
UPDATE 107
DELETE 114
Detecting DML Errors 118
Summary 118

Chapter 6: The Mighty SELECT Statement 119

Simple SELECTs 119
Computational and Derived Fields 120
SELECT TOP 121
Derived Tables 122
Joins 126
Predicates 128
Subqueries 140
Aggregate Functions 147
GROUP BY and HAVING 150
UNION 157
ORDER BY 159
Summary 161

Chapter 7: Views 163

Restrictions 163
ANSI SQL Schema VIEWs 165
Getting a VIEW's Source Code 166
Updatable VIEWs 166
WITH CHECK OPTION 167
Derived Tables 167
Dynamic VIEWs 168
Partitioning Data Using Views 170
Summary 172

Chapter 8: Statistical Functions 173

The Case for CASE 174
Efficiency Concerns 176
Variance and Standard Deviation 176
Medians 177
Clipping 185
Returning the Top n Rows 186
Rankings 190
Modes 193
Histograms 193
Cumulative and Sliding Aggregates 195
Extremes 197
Summary 199

Chapter 9: Runs and Sequences 201

Sequences 201
Runs 207
Intervals 210
Summary 212

Chapter 10: Arrays 213

Arrays as Big Strings 213
Arrays as Tables 220
Summary 228

Chapter 11: Sets 229

Unions 230
Differences 231
Intersections 234
Subsets 235
Summary 239

Chapter 12: Hierarchies 241

Simple Hierarchies 241
Multilevel Hierarchies 242
Indented Lists 249
Summary 250

Chapter 13: Cursors 251

On Cursors and ISAMs 251
Types of Cursors 253
Appropriate Cursor Use 258
T-SQL Cursor Syntax 263
Cofiguring Cursors 272
Updating Cursors 276
Cursor Variables 277
Cursor Stored Procedures 279
Optimizing Cursor Performance 279
Summary 281

Chapter 14: Transactions 283

Transactions Defined 283
How SQL Server Transactions Work 284
Types of Transactions 285
Avoiding Transactions Altogether 287
Automatic Transaction Management 288
Transaction Isolation Levels 289
Transaction Commands and Syntax 293
Debugging Transactions 299
Optimizing Transactional Code 300
Summary 301

Chapter 15: Stored Procedures and Triggers 303

Stored Procedure Advantages 304
Internals 305
Creating Stored Procedures 307
Executing Stored Procedures 316
Environmental Concerns 317
Parameters 320
Important Automatic Variables 323
Flow Control Language 324
Errors 325
Nesting 328
Recursion 328
Autostart Procedures 330
Encryption 330
Triggers 330
Debugging Procedures 334
Summary 335

Chapter 16: Transact-SQL Performance Tuning 337

General Performance Guidelines 337
Database Design Performance Tips 338
Index Performance Tips 340
SELECT Performance Tips 342
INSERT Performance Tips 344
Bulk Copy Performance Tips 344
DELETE and UPDATE Performance Tips 346
Cursor Performance Tips 346
Stored Procedure Performance Tips 347
SARGs 351
Denormalization 368
The Query Optimizer 384
The Index Tuning Wizard 394
Profiler 396
Perfmon 397
Summary 399

Chapter 17: Administrative Transact-SQL 401

GUI Administration 401
System Stored Procedures 402
Administrative Transact-SQL Commands 402
Administrative System Functions 402
Administrative Automatic Variables 402
Where's the Beef? 404
Summary 461

Chapter 18: Full-Text Search 463

Full-Text Predicates 468
Rowset Functions 471
Summary 474

Chapter 19: OLE Automation 475

sp_exporttable 476
sp_importtable 480
sp_getSQLregistry 484
Summary 486

Chapter 20: Undocumented T-SQL 487

Defining Undocumented 487
Undocumented DBCC Commands 488
Undocumented Functions and Variables 499
Undocumented Trace Flags 502
Undocumented Procedures 503
Summary 509

Chapter 21: Potpourri 511

Obscure Functions 511
Data Scrubbing 521
Iteration Tables 525
Summary 526

Appendix: Suggested Resources 527

Books 527
Internet Resources 528

Index 529


Customer Reviews

Customer Reviews: 2     Average Customer Rating:

Sep 23, 2003     Brad Sullivan from Oklahoma City, OK
Can't live without it
I swear there's a gold nugget on every page of this book. Even if you're not much of a reader, and you just want a good SQL reference, this book is the one. I would encourage every T-SQL developer to read this book.

It starts out with your basic SQL and works up from there. Pretty much anyone who has already been doing basic SELECT statements can pick it up and start comprehending what the author's trying to say. If your more advanced, it's great to because the author focus's on the tricks of T-SQL and will usually show you more than one way to come up with the same result. Each step builds on the last step.

Sep 26, 2000     Jorge Sierra (asierra01@yahoo.com) from Miami, Fl
Very good book
It has good samples how to use COM inside MS-SQL code. I found the sample about exporting data to ascii files just using T-SQL also very helpful.



Forgot your password?
FAQs
Shipping Options
Returns
Your Orders
Your Account