我的UDF的主体有以下HAVING类。
HAVING
Company.Description = @Company AND
SystemCustomerType.Description = @CustomerType
我尝试通过以下语法调用它。
SELECT * FROM FunctionName('ABC_Company',NULL)
还尝试将NULL
参数的默认值设置为@CustomerType
。并通过
SELECT * FROM FunctionName('ABC_Company',default)
答案 0 :(得分:3)
试试这个:
where (Company.Description = @Company or @Company is null)
and (SystemCustomerType.Description = @CustomerType or @CustomerType is null)
然后使用:
select * from FunctionName('ABC_Company',NULL)
答案 1 :(得分:0)
您可以使用NULL作为参数,然后:
tableHeaderView
如果您不需要在NULL和空字符串
之间进行区分答案 2 :(得分:0)
'something'= NULL始终返回false。要检查某些内容是否为NULL,请使用'is'。
HAVING
Company.Description = @Company AND
(SystemCustomerType.Description = @CustomerType
or (SystemCustomerType.Description is null and @CustomerType is null))