I’ve got a SQL Function which has 3 parameters. The 3rd parameter has a default value of NULL. However, I cannot just write:
dbo.myFunction(Param1, Param2)
I get the error:
An insufficient number of arguments were supplied for the procedure or function dbo.myFunction.
Therefore I’ve got to write:
dbo.myFunction(Param1, Param2, NULL)
dbo.myFunction(Param1, Param2, default)
Is there a way I can just write dbo.myFunction(Param1, Param2)? I think this is a lot cleaner (and saves me having to modify an existing function which I’ve added a new param to!)
They are default parameters as opposed to optional parameters & must always be passed in the call with a value or
default.If you wanted to you could make your existing
dbo.myFunction(Param1, Param2)calldbo.myFunctionEx(Param1, Param2, default)