tags:

views:

73

answers:

1

Hi


Assuming A.sql contains the following code, then second Select 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

+2  A: 

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.

Vinko Vrsalovic
thanx for your help
carewithl