Skip to main content
Top

2015 | OriginalPaper | Chapter

3. Procedural Code

Authors : Miguel Cebollero, Jay Natarajan, Michael Coles

Published in: Pro T-SQL Programmer's Guide

Publisher: Apress

Activate our intelligent search to find suitable subject content or patents.

search-config
loading …

Abstract

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. Chapter 1 introduced you to SQL 3VL, and this chapter expands further on this topic. SQL 3VL is different from most other programming languages’ simple two-valued Boolean logic. This chapter also discusses T-SQL control-of-flow constructs, which allow you to change the normally sequential order of statement execution. Control-of-flow statements let you branch your code logic with statements like IF…ELSE…, perform loops with statements like WHILE, and perform unconditional jumps with the GOTO statement. You’re also introduced to CASE expressions and CASE-derived functions that return values based on given comparison criteria in an expression. Finally, we finish the chapter by explaining a topic closely tied to procedural code: SQL cursors.

Dont have a licence yet? Then find out more about our products and how to get one now:

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Footnotes
1
A Case against the GO TO Statement by: Edsger W Dijkstra; Technology University Eindhoven, The Netherlands http://​www.​cs.​utexas.​edu/​users/​EWD/​transcriptions/​EWD02xx/​EWD215.​html
 
Metadata
Title
Procedural Code
Authors
Miguel Cebollero
Jay Natarajan
Michael Coles
Copyright Year
2015
Publisher
Apress
DOI
https://doi.org/10.1007/978-1-4842-0145-9_3

Premium Partner