Chapter 5: Composite Transact-SQL ConstructsBatches, Scripts, and Transactions


Overview

Transact-SQL (T-SQL) statements can be grouped and executed together in a variety of ways. They can be

  • Compiled as a part of a stored procedure, user-defined function, or trigger

  • Written and executed individually or in groups from client utilities in the form of batches

  • Grouped and stored in external script files that can be opened and executed from various client utilities

  • Grouped in transactions that succeed completely or fail completely

This chapter discusses batches, scripts, and transactions.

It is not necessary to run examples from the text against the Asset5 database, but if you do, you must first make sure that the database contains the following table by executing the following script against the Asset5 database:

      Create Table Part(PartId int identity,                        Make varchar(50),                        Model varchar(50),                        Type varchar(50}} 

This table is used to illustrate the concepts discussed in this chapter. Some of the changes are destructive, so existing tables such as Equipment will not be used, which may be needed for other purposes later.




Microsoft SQL Server 2005 Stored Procedure Programming in T-SQL &  .NET
Microsoft SQL Server 2005 Stored Procedure Programming in T-SQL & .NET
ISBN: 0072262281
EAN: 2147483647
Year: 2006
Pages: 165

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net