【【【存储过程能加判断控制条件在where吗】】】】】
CREATE PROCEDURE SP_CustUserListSearchItem
@strUserName nvarchar(100),
@strAccountId nvarchar(50),
@strAccountName nvarchar(100),
@strAccountType nvarchar(6),
@numcustid numeric,
@strContrStatus nvarchar(6)
AS
BEGIN
SELECT
numUserId
FROM tbCustUserInfo
where 1=1
IF (@strUserName != '' ) --如果if和end不加是可以的
and strUserName like '% @strUserName %'
end
IF @@ERROR!=0
BEGIN
RAISERROR 20000 'SP_CustUserListSearchItem: Cannot load data on tbCustUserInfo'
RETURN(1)
END
END
GO