Why the DEFAULT keyword is allowed in the CREATE PROCEDURE command

The DEFAULT keyword appears in the following expression, where the parameter is set to the default value.

CREATE PROCEDURE usp_Test
    @sp_param1 varchar(20) = DEFAULT
AS
    SELECT @sp_param1 AS myTest
;

NULL is assigned to @ sp_param1. But the default value must be a constant or NULL keyword.

Why is the DEFAULT keyword allowed in this situation?

+5
source share
1 answer

The DEFAULT keyword is a placeholder for something that you want to provide, but is actually not even NULL. Most commonly found in

exec SProcName 2, DEFAULT

, , , DEFAULT .

CREATE PROC, , NULL.

+2

All Articles