ReturnValue vs. Output Parameter

  • 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

  • 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.

  • 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

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply