The RETURN Statement

The RETURN statement is used to exit unconditionally from a stored procedure. In other words, if SQL Server reaches a RETURN statement when executing a stored procedure, it stops processing and returns the control to the calling application.

The RETURN statement has one parameter,the return value,which is an integer that can be used to communicate with the calling application. When creating a stored procedure, if you use a data type other than integer for the return value, SQL Server allows you to create the stored procedure, but you will get an error when it is executed.

The return value is 0 by default; therefore, if a stored procedure containsa RETURN statement without this parameter, the return value will be 0. Therefore, ...

Get Microsoft® SQL Server™ 2000 Programming by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.