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附近語法不正確 –