BLOGS BY TOPIC
BLOGS BY AUTHOR
BLOGS BY YEAR
This blog teaches you how to return values from your SQL stored procedures using two different techniques: return codes, and output parameters.
- Returning Values from Stored Procedures in SQL (this blog)
- Using Return Codes with Stored Procedures
- Using Output Parameters
Posted by Andrew Gould on 26 April 2013
You need a minimum screen resolution of about 700 pixels width to see our blogs. This is because they contain diagrams and tables which would not be viewable easily on a mobile phone or small laptop. Please use a larger tablet, notebook or desktop computer, or change your screen resolution settings.
Returning Values from Stored Procedures in SQL
There are two techniques for returning values from a stored procedure: using return codes, and using output parameters. The main differences between these techniques are described in the table below:
|Return code||A stored procedure can return a single value using a return code. The data type of the value must be an integer (a whole number).|
|Output parameter||A stored procedure can have many output parameters. An output parameter can use any data type.|
Output parameters are more flexible than return codes but they are a little more fiddly to use. The rest of this blog series will show you how to use each of these techniques, starting with return codes.