January 14, 2011 at 2:30 pm
Sorry, this might be my dumbest post yet. But I can't seem to find a simple explanation.
I'm unclear on exactly what "RETURN" does. BoL says it "[immediately] exits unconditionally from a query or procedure."
But then in the context of a UDF, you have to have a RETURN clause, which is followed by stuff that you want to be returned.
So which is it? Does it exit immediately, or does it return stuff that follows it?
And then, to make matters worse for stupid people, there's also "RETURNS"...
🙁
January 14, 2011 at 2:45 pm
autoexcrement (1/14/2011)
Sorry, this might be my dumbest post yet. But I can't seem to find a simple explanation.I'm unclear on exactly what "RETURN" does. BoL says it "[immediately] exits unconditionally from a query or procedure."
But then in the context of a UDF, you have to have a RETURN clause, which is followed by stuff that you want to be returned.
So which is it? Does it exit immediately, or does it return stuff that follows it?
And then, to make matters worse for stupid people, there's also "RETURNS"...
🙁
RETURN does both. It exits the current proc and returns to the calling proc or the "system" that called it. If a value follows the RETURN, it also returns that value.
It is not usual to consider it to be an "abort" though because if a sproc is called from another sproc, the RETURN doesn't stop the outer sproc from continuing. It's more like a "RETURN" from GOSUB in BASIC.
--Jeff Moden
Change is inevitable... Change for the better is not.
January 14, 2011 at 2:48 pm
THANK YOU!
January 14, 2011 at 4:51 pm
You bet... thanks for the feedback.
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply