Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
dbarasch
Starting Member
1 Post |
Posted - 2010-03-24 : 07:52:44
|
| Is there a preference to use when returning stored procedure values back to the calling program? Should I be using the Return Value or output parameters? Is there a benefit from using one as oppose to the other? |
|
|
Kristen
Test
22859 Posts |
Posted - 2010-03-24 : 07:56:03
|
| Both!We return a code to indicate success (0) or error (non-zero)We return an OUTPUT variable with an error code, and also a "user friendly message" and often other things too.I never return, for example, the ID (IDENTITY) allocated to a newly inserted Row as the RETURN value of an SProc, I only ever do that using OUTPUT parameter (or sometimes a ResultSet if that is easier for the Application to handle) |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-03-24 : 11:21:44
|
| also you can return only integer values using RETURN in proc whereas OUTPUT parameters can be of any type.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
|
|
|