Log in
::
Register
::
Not logged in
Home
Tags
Articles
Editorials
Stairways
Forums
Scripts
Videos
Blogs
QotD
Books
Ask SSC
SQL Jobs
Training
Authors
About us
Contact us
Newsletters
Write for us
Recent Posts
Recent Posts
Popular Topics
Popular Topics
Home
Search
Members
Calendar
Who's On
Home
»
SQL Server 7,2000
»
T-SQL
»
ReturnValue vs. Output Parameter
ReturnValue vs. Output Parameter
Rate Topic
Display Mode
Topic Options
Author
Message
meichner
meichner
Posted Tuesday, August 12, 2008 6:54 AM
SSC Veteran
Group: General Forum Members
Last Login: Monday, February 06, 2012 12:43 PM
Points: 215,
Visits: 640
I am a c# programmer. I need to be able to return the ID of a row that I just inserted into the database using SCOPE_IDENTITY(). I have seen implementations that return this value as an Output parameter and others as a ReturnValue. Is one method preferrable over the other? If so, why?
Thanks
Post #550931
Lenny-319914
Lenny-319914
Posted Tuesday, August 12, 2008 7:08 AM
SSC Eights!
Group: General Forum Members
Last Login: Tuesday, October 23, 2012 11:34 AM
Points: 944,
Visits: 403
i use return values to tell me whether or not a proc ran successfully or encountered any errors, and i use output parameters to return specific values encountered by the proc. you only have one return value, but potentially many output parameters.
that's just me though... i've seen others use return values to return specific values encountered by the proc.
edit: also, i believe return values can only return int values... parameters can return so much more.
Post #550948
meichner
meichner
Posted Tuesday, August 12, 2008 7:56 AM
SSC Veteran
Group: General Forum Members
Last Login: Monday, February 06, 2012 12:43 PM
Points: 215,
Visits: 640
Thanks. I got in a habit (good or bad) of raising errors when a problem occurs in a stored procedure as opposed to using return values. I am curious if there any down side to using Output parameters?
Thanks
Post #551014
« Prev Topic
|
Next Topic »
Permissions
You
cannot
post new topics.
You
cannot
post topic replies.
You
cannot
post new polls.
You
cannot
post replies to polls.
You
cannot
edit your own topics.
You
cannot
delete your own topics.
You
cannot
edit other topics.
You
cannot
delete other topics.
You
cannot
edit your own posts.
You
cannot
edit other posts.
You
cannot
delete your own posts.
You
cannot
delete other posts.
You
cannot
post events.
You
cannot
edit your own events.
You
cannot
edit other events.
You
cannot
delete your own events.
You
cannot
delete other events.
You
cannot
send private messages.
You
cannot
send emails.
You
may
read topics.
You
cannot
rate topics.
You
cannot
vote within polls.
You
cannot
upload attachments.
You
may
download attachments.
You
cannot
post HTML code.
You
cannot
edit HTML code.
You
cannot
post IFCode.
You
cannot
post JavaScript.
You
cannot
post EmotIcons.
You
cannot
post or upload images.
Copyright © 2002-2013 Simple Talk Publishing. All Rights Reserved.
Privacy Policy.
Terms of Use.
Report Abuse.