I tried changing a default parameter value with this:
ALTER PROCEDURE [dbo].[my_sp]
@currentDate datetime = GETDATE()
and all the SQL pre-c
I infer you're using Microsoft SQL Server from the square brackets in your example.
From MSDN:
Only a constant value, such as a character string; a scalar function (either a system, user-defined, or CLR function); or NULL can be used as a default.
The function GETDATE()
returns a different value from time to time, so it is not a constant expression.