Home > Store

Transact-SQL Desk Reference: For Microsoft SQL Server

Register your product to gain access to bonus material or receive a coupon.

Transact-SQL Desk Reference: For Microsoft SQL Server


  • Sorry, this book is no longer in print.
Not for Sale


  • Copyright 2004
  • Dimensions: 7" x 9-1/4"
  • Pages: 816
  • Edition: 1st
  • Book
  • ISBN-10: 0-13-029339-3
  • ISBN-13: 978-0-13-029339-8

This is the SQL reference you'll reach for first, every time!

If you're an SQL programmer, you can easily picture how useful a comprehensive, single-volume Transact-SQL command reference manual would be in streamlining your work. And if that book was rich in examples, was written with users of all levels of expertise in mind, and was even designed to fit comfortably on your desktop, you'd probably buy it right away, wouldn't you? Well, look no further—Transact-SQL Desk Reference, by noted programming instructor Deac Lancaster, is exactly the book you need.

As it turns out, Transact-SQL Desk Reference is just the book Deac himself was looking for. The problem was, no such book existed, so he saved programmers everywhere a lot of trouble and he wrote it himself! The book answers the question, "How exactly do I write a statement to do a particular job?" by providing the full syntax of each command along with examples showing each command in action. Then, to assist you in making your code more portable, Transact-SQL Desk Reference shows where Transact-SQL diverges from the ANSI SQL standard. The commands are arranged by functional area and are well indexed and cross-referenced, making it as easy as possible to find what you're looking for-even if you don't know the command's name. Inside, you'll find:

  • SQL commands grouped logically by purpose and function, plus an index so you can jump right to the command
  • Definitions that give the full syntax of each command, along with examples of each command in use plus tips on maximizing portability
  • Additional chapters covering RDBMS concepts, details of Transact-SQL, and advanced SELECT queries!

This book is intended for programmers of all levels working with Microsoft SQL Server.

Sample Content

Online Sample Chapter

SQL Building Blocks and Server Settings

Downloadable Sample Chapter

Untitled Document

Download Chapter 2 Part A of this title.

Download Chapter 2 Part B of this title.

Table of Contents



1. RDBMS Concepts — A Primer.

Database Management System Background. Brief History of Relational DBMSs and SQL Language. SQL Language. Where Does SQL Fit In? Chronology of SQL Standards. SQL Server 2000 Product Line. Client-Server Architecture. Three-Tier Client-Server Architecture. RDBMS: Tables and Databases. Tables in a Database. Databases in Microsoft SQL Server. The SQL Language and MSS's Transact-SQL. Comments. Data Types — First Look. Domain and NULL Values. Metadata and Data. Data Definition Language (DDL) and Data Manipulation Language (DML). DDL Examples—CREATE TABLE, ALTER TABLE, DROP TABLE. DML Examples—INSERT, UPDATE, DELETE, SELECT. Case Sensitivity in SQL Statements. RDBMS Utility to Show Table Structure. Lab Exercises. Lab Exercise 1: Introduction to Using Microsoft SQL Server. Lab Exercise 2: CREATE TABLE. Lab Exercise 3.

2. SQL Building Blocks and Server Settings.

SQL Server Instance. The SQL Server Database. Data Representation. General Data Type Information. Domain and NULL Value. Constant (Literal) Defined. Identifiers—Naming SQL Objects. Using Identifiers as Qualified Object Names. Expressions in an SQL Statement. Operators. SQL Server 2K Data Types. Numeric Data Type Overview. String Data Type Overview. Other Data Type Overview. Transact-SQL Data Type Precedence. Transact-SQL Data Type Hierarchy. BIGINT, INT, SMALLINT and TINYINT Details. BIT Data Type Details. DECIMAL and NUMERIC Data Type Details. MONEY and SMALLMONEY Data Type Details. FLOAT and REAL Data Type Details. DATETIME and SMALLDATETIME Data Type Details. CHAR and VARCHAR Data Type Details. NCHAR and NVARCHAR Data Type Details. SYSNAME Data Type Details. TEXT, NTEXT and IMAGE Data Type. BINARY(n) and VARBINARY(n) Data Type Details. CURSOR Data Type Details. SQL_VARIANT Data Type Details. TABLE Data Type Details. TIMESTAMP (ROWVERSION) Data Type Details. UNIQUEIDENTIFIER Data Type Details. User-Defined Data Types. Enterprise Manager—Create and Manage a User-Defined Data Type. Transact-SQL—Create and Manage a User-Defined Data Type. Transact-SQL Functions. Aggregate Functions. Cursor Functions. Configuration Functions. Date and Time Functions. Mathematical Functions. Metadata Functions. Rowset Functions. Security Functions. String Functions — for CHAR or VARCHAR expressions. System Functions. System Statistical Functions. Text and Image Functions and Statements. Deterministic and Nondeterministic Functions. CASE Expression. CAST and CONVERT. System Stored Procedures and DBCC. System Stored Procedures. DBCC. Server, Database and Session Settings. Settings Overview. Database Configuration (Database Properties). Session (Connection) Configuration Settings. Default Nullability of New Columns in a Table. Collation.

3. Data Definition Language and Security.

Data Definition Language (DDL). Metadata and Data. Types of Objects Managed by DDL. sp_detach_db and sp_attach_db. CREATE, ALTER, DROP DATABASE. sp_bindefault and sp_unbindefault. CREATE, DROP DEFAULT. CREATE, ALTER, DROP FUNCTION. Query Analyzer Debugger Functions (UDF). CREATE, DROP INDEX. CREATE, ALTER, DROP PROCEDURE. Query Analyzer Stored Procedure DebuggerDebugger. CREATE RULE, DROP RULE, sp_bindrule. CREATE SCHEMA. CREATE, UPDATE, DROP STATISTICS. STATS_DATE. CREATE, ALTER, DROP TABLE. CREATE, ALTER, DROP TRIGGER. CREATE, ALTER, DROP VIEW. Indexed View. PARTITIONED VIEWS. Displaying Metadata. System Stored Procedures to Display Metadata. ANSI Information Schema Views. Metadata Functions. SELECT statements on the system tables. Using Enterprise Manager to Observe Metadata. Security. Client Program Login to SQL Server. SQL Server Authentication Mode Options. Database Level Access. Roles. Creating Logins and Roles. Chapter Lab Exercises. Lab Exercise 1: CREATE TABLE emps3, depts3.

4. Data Manipulation Language—INSERT, UPDATE, DELETE, SELECT.

INSERT. INSERT Syntax. INSERT and SELECT with an IDENTITY Column. UPDATE. UPDATE—Basic Syntax. UPDATE—Complete Syntax. DELETE. DELETE Syntax. TRUNCATE TABLE. TRUNCATE TABLE Syntax. SELECT. SELECT Statement Syntax. Column Aliases. SET Operations. SET Operations — UNION, UNION ALL. SET Operations — INTERSECTION. SET Operations — SET DIFFERENCE. Hints—Join Hints, Query Hints and Table Hints.

5. Transaction Control, Backup and Restore and Transact-SQL Programming.

Transaction Control—ANSI SQL and MSS. Transaction Concepts. Starting and Ending a Transaction. ISOLATION Is Obtained through Locking. Automatic (Implicit) Transaction Mechanisms. Explicit Transaction Mechanisms. Transaction Control: Isolation Levels. Defining Isolation Levels. Implementation of the Isolation Levels Using Locks (MSS). Setting Isolation Level. Server Shutdown. MSS 2000. MSS 7. @@version. Identifying Version and Service Pack. BACKUP AND RESTORE. File System Backup vs Database Backup. Database Backup. Types of SQL Server Database Backup. Transaction Log Backup (TLBU). MSS 2000 Recovery Models. BACKUP DATABASE, BACKUP LOG. BACKUP DATABASE. BACKUP LOG. Truncate Log—Emptying the Transaction Log. BACKUP—1. Backup Dialog. RESTORE DATABASE. RESTORE LOG. Restore Dialog. RESTORE Command. Restore Using Example Backup Strategy. Comments about Backup and Restore. Database Layout for Performance and Restorability. RAID. Production Database—Suggested Disk Layout 1. Production Database—Suggested Disk Layout 2. Introduction to Transact-SQL Programming. Batches. EXEC[UTE]. Two forms of SQL Comments. PRINT. Variables. Program Flow Control. BEGIN - END. RETURN. IF-ELSE. WHILE, BREAK, CONTINUE. GOTO and Labels. WAITFOR. Example TRANSACT-SQL Stored Procedure. Error Handling. Managing Error Messages. sp_addmessage, sp_altermessage, sp_dropmessage. @@ERROR. RAISERROR. Cursors. SQL-92 Cursor. Transact-SQL Extended Cursor (T-SQL Cursor). Commands Used with Cursors. Cursor Functions and Stored Procedures. Dynamic SQL.

Appendix A.

Appendix B.




Submit Errata

More Information

Unlimited one-month access with your purchase
Free Safari Membership