遇到这个问题,是因为存储过程的参数,设置默认值写错了。
错误写法
@WhiteIp NVARCHAR(MAX) NULL,
Stored procedure with default parameters
I wrote with parameters that are predefined
They are not "predefined" logically, somewhere inside your code. But as arguments of SP they have no default values and are required. To avoid passing those params explicitly you have to define default values in SP definition:
Alter Procedure [Test]
@StartDate AS varchar(6) = NULL,
@EndDate AS varchar(6) = NULL
AS
...
NULLs or empty strings or something more sensible - up to you. It does not matter since you are overwriting values of those arguments in the first lines of SP.
Now you can call it without passing any arguments e.g. exec dbo.TEST
修正之后的写法
@WhiteIp NVARCHAR(MAX) = NULL,