Sybase Technical Library - Product Manuals Home
[Search Forms] [Previous Section with Hits] [Next Section with Hits] [Clear Search] Expand Search

Chapter 12 Defining Defaults and Rules
for Data [Table of Contents] Chapter 14 Using Stored Procedures

Transact-SQL User's Guide

[-] Chapter 13 Using Batches and Control-of-Flow Language

Chapter 13

Using Batches and Control-of-Flow Language

Transact-SQL allows you to group a series of statements as a batch, either interactively or from an operating system file. You can also use Transact-SQL's control-of-flow language to connect the statements, using programming constructs.

A variable is an entity that is assigned a value. This value can change during the batch or stored procedure in which the variable is used. Adaptive Server has two kinds of variables: local and global. Local variables are user-defined, whereas global variables are supplied by the system and are predefined.

Introduction
[-] Rules associated with batches
Examples of using batches
Batches submitted as files
[-] Using control-of-flow language
if...else
[+] case expression
begin...end
while and break...continue
declare and local variables
goto
return
print
raiserror
Creating messages for print and raiserror
waitfor
[+] Comments
[-] Local variables
Declaring local variables
Local variables and select statements
Local variables and update statements
Local variables and subqueries
Local variables and while loops and if...else blocks
Variables and null values
[-] Global variables
[+] Transactions and global variables
Global variables affected by set options
Language and character set information in global variables
Global variables for monitoring system activity
Server information stored in global variables
Global variables and text and image data


Chapter 12 Defining Defaults and Rules
for Data [Table of Contents] Introduction