Chapter 4. Procedural Code and CASE Expressions
T-SQL has always included support for procedural programming in the form of control-of-flow statements and cursors. One thing that throws developers from other languages off their guard when migrating to SQL is the peculiar three-valued logic (3VL) we enjoy. I will introduce SQL 3VL, which is different from most other programming languages' simple two-valued Boolean logic, in this chapter. I will also discuss T-SQL control-of-flow constructs, which allow you to change the normally sequential order of statement execution. Control-of-flow statements allow you to branch your code logic with statements like IF...ELSE...
, perform loops with statements like WHILE
, and perform unconditional jumps with the ...
Get Pro T-SQL 2008 Programmer's Guide 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.