更新时间:2023-11-30 21:01:40
在SQL中,您无法比较空值,即,即使字段中的值为空,EngSerialNum = null
始终求值为false.
In SQL you can't compare null values, i.e. EngSerialNum = null
always evaluates to false, even if the value in the field is null.
您可以动态创建查询,以便使用is null
来匹配空值,或者可以使用如下表达式:
Either you can create the query dynamically so that you use is null
to match the null values, or you can use an expression like this:
((EngSerialNum is null and @EngSerialNo is null) or EngSerialNum = @EngSerialNo)