While researching something I can across an MSDN article which says:
Exits unconditionally from a query or procedure. RETURN is immediate
and complete and can be used at any point to exit from a procedure,
batch, or statement block. Statements that follow RETURN are not
executed.
The documentation didn’t come close to the specific situation I was researching. After reading it I realized that I didn’t understand the Return statement, and (more specifically) the definition of “statement blocks” as well as I thought. So…
What exactly is a t-sql “statement block”? Are they defined by Begin ... End like brackets in C#, { ... }, or something else entirely?
Thanks!
They come in a variety of flavors (try, catch) but generally they look like