Microsoft Transact-SQL allows you to use standard SQL as a programming language to write logic that can execute within the database engine. This extremely powerful capability is one of the keys to the success and growth of Microsoft SQL Server. Transact-SQL simplifies application development and reduces the amount of conversation necessary between the client application and the server by allowing more code to be processed at the server.
In this book, we won't delve into all the available syntax of the Transact-SQL language. We'll leave that to the SQL Server documentation. Instead, we'll see the significant programming constructs available, along with some comments and examples. In Chapter 7, "Querying Data" we examined the SELECT statement, which is the foundation for effective use of Transact-SQL. Before reading any further, be sure you have a good understanding of the concepts presented in that chapter.
This chapter focuses on the Transact-SQL programming extensions, such as control of flow, looping, error handling, and environment-specific options. These extensions allow you to easily write complex routines entirely in SQL, and they provide the basis for the additional power of Transact-SQL over standard SQL. In Chapter 10 we'll look at cover batches, transactions, stored procedures, and triggers. Chapter 11 deals with cursors , which bridge the set-based world of SQL with sequential processing. In Chapter 12 we'll look at some extensive Transact-SQL examples that sometimes use Transact-SQL in nonintuitive ways. For those of you interested in developing applications using SQL Server, all of these chapters provide important information.