Establishing Flow Control

Probably the most powerful set of Transact-SQL features involves its capability to control program flow. Flow control is the ability that you have as a programmer to control each step your program takes in processing data. If you have programmed with other popular languages such as C, COBOL, Pascal, and Visual Basic, you are probably already familiar with control commands such as IF...THEN statements and with loops, which enable you to force a series of statements to be executed based on certain criteria that you define within the program. This section contains some of the major commands that allow you to enforce program flow control.

BEGIN and END Statements

Transact-SQL uses the BEGIN and END statements to signify ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.