devxlogo

Return the Results of a T-SQL Procedure Execution

Return the Results of a T-SQL Procedure Execution

The RETURN keyword lets you exit from a T-SQL batch or stored procedure. You can specify an optional integer variable with RETURN to pass a status value to the calling procedure, which can evaluate the return code and perform different actions depending on the results of the T-SQL batch or stored procedure.

 RETURN @return_code

If no value is specified in RETURN statement, Microsoft SQL Server returns one of the reserved numbers (0 through -99). A 0 means that the stored procedure completed successfully. A negative number indicates an error condition. However, presently only numbers -1 through -14 are being used.

devx-admin

Share the Post: