我有一个看起来像这样的存储过程:
CREATE PROCEDURE dbo.usp_TestFilter
@AdditionalFilter BIT = 1
AS
SELECT *
FROM dbo.SomeTable T
WHERE
T.Column1 IS NOT NULL
AND CASE WHEN @AdditionalFilter = 1 THEN
T.Column2 IS NOT NULL
不用说,这是行不通的。如何激活检查 @AdditionalFilter 参数的附加 where 子句?谢谢你的帮助。