Stored Procedure, when to use Output parameter vs Return variable

前端 未结 7 1465
不思量自难忘°
不思量自难忘° 2020-12-28 12:54

When would you use an output parameter vs a return variable, or vice versa? In the following simple example, I can achieve the same thing using either one.

Using out

相关标签:
7条回答
  • 2020-12-28 13:34

    I prefer:

    Using a return value when you only need to return one item.

    Using output parameters when you need to return more than one value.

    Another common usage pattern, although not my preference, is to use return values only to inform of success or failure and output parameters for anything that needs to be returned.

    0 讨论(0)
提交回复
热议问题