The defaults can be chained from one parameter to another.In the example below, the default for @x1 is assigned to @x2 and that in turn is assigned to @x3.create procedure #temp ( @x1 int = 1, @x2 int = @x1, @x3 int = @x2 )asselect x1 = @x1, x2 = @x2, x3 = @x3goexec #tempexec #temp 5exec #temp @x2 = 4godrop proc #temp
Results:x1 x2 x3 ----------- ----------- ----------- 1 1 1 (1 row(s) affected)x1 x2 x3 ----------- ----------- ----------- 5 5 5 (1 row(s) affected)x1 x2 x3 ----------- ----------- ----------- 1 4 4 (1 row(s) affected)
CODO ERGO SUM