﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / SQL Server Newbies  / RETURN clause, clarification / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Thu, 20 Jun 2013 03:17:39 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: RETURN clause, clarification</title><link>http://www.sqlservercentral.com/Forums/Topic1048219-1292-1.aspx</link><description>You bet... thanks for the feedback.</description><pubDate>Fri, 14 Jan 2011 16:51:39 GMT</pubDate><dc:creator>Jeff Moden</dc:creator></item><item><title>RE: RETURN clause, clarification</title><link>http://www.sqlservercentral.com/Forums/Topic1048219-1292-1.aspx</link><description>THANK YOU!</description><pubDate>Fri, 14 Jan 2011 14:48:18 GMT</pubDate><dc:creator>autoexcrement</dc:creator></item><item><title>RE: RETURN clause, clarification</title><link>http://www.sqlservercentral.com/Forums/Topic1048219-1292-1.aspx</link><description>[quote][b]autoexcrement (1/14/2011)[/b][hr]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"...:([/quote]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.</description><pubDate>Fri, 14 Jan 2011 14:45:08 GMT</pubDate><dc:creator>Jeff Moden</dc:creator></item><item><title>RETURN clause, clarification</title><link>http://www.sqlservercentral.com/Forums/Topic1048219-1292-1.aspx</link><description>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"...:(</description><pubDate>Fri, 14 Jan 2011 14:30:53 GMT</pubDate><dc:creator>autoexcrement</dc:creator></item></channel></rss>