I have a stored procedure with an output parameter that I initialize with "0":
ALTER PROCEDURE dbo.SomeProcedure @someparam INT = 0 OUT ...
However, when the procedure does not change or set this parameter at run time, the output value is NULL, not "0", as expected.
Is it mandatory to set a default value in the procedure code
SET @someparam = 0;
and avoid initialization in the declaration?
Why does SQL Server allow you to enter default values ββin the declaration for output parameters?
source share