1
如果参数@ABC不为空,则在查询如果查询在存储过程
@XYZ bigint,
@ABC tinyint=null
select * from WTY where
[email protected] and [email protected]
---当@ABC为null,没有得到任何结果 增加 - 需要ABC condion检查只有当@ABC不为空
如果参数@ABC不为空,则在查询如果查询在存储过程
@XYZ bigint,
@ABC tinyint=null
select * from WTY where
[email protected] and [email protected]
---当@ABC为null,没有得到任何结果 增加 - 需要ABC condion检查只有当@ABC不为空
使用此
@XYZ bigint,
@ABC tinyint=null
select * from WTY where
[email protected] and [email protected] OR @ABC is NULL
,或者您也可以使用
select * from WTY where
[email protected] and ABC=isnull(@ABC , ABC)
IF附近语法不正确 –