The Return statement
Assuming A.sql contains the following code, then second Se开发者_StackOverflow中文版lect query won’t be executed due to Return statement:
select *
from Films;
return;
select *
from Films;
If A.sql was called inside a stored procedure SP1 or batch B1, then RETURN would transfer control back to SP1 or B1, respectively. But assuming A.sql isn’t called from inside of another object ( batch, SP, UDF … ), to what is control transferred to ( in other words, where does RETURN return to )?
thanx
return returns 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.
So this just means that if there is no outer frame, execution simply ends.
精彩评论