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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.