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 output parameter
create proc dbo.TestOutput (@InValue int, @OutValue int output)
as
set @OutValue = @InValue
declare @x int
exec TestOutput @InValue = 3, @OutValue = @x output
select @x
Using return variable:
create proc dbo.TestReturn (@InValue int)
as
return @InValue
declare @x int
exec @x = TestReturn @InValue = 3
select @x
As you can see, they both do the same thing. Can someone show me an example where the choice of a output parameter vs a return variable would make a difference?