问题描述
当我们不想使用那么多if else语句时,我们会选择And或语句来检查商店的参数程序并显示记录。我想知道写这样的陈述的最佳做法是什么
例如
和(e .BusinessUnitId = @BusinessUnitId OR(@ BusinessUnitId IS NULL或@BusinessUnitId = 0))
i想知道这是否是正确的方式然后才能成为第一个,检查null然后进行实际的参数检查,或者还有其他任何好的语句备选方案。
请建议
Hi ,
When we do not want to use so much if else statements we go for "And" "or" statements which checks the parameters of the store procedure and displays the record . I want to know what is the best practice of writing such statement
For example
and (e.BusinessUnitId = @BusinessUnitId OR (@BusinessUnitId IS NULL OR @BusinessUnitId = 0))
i was wondering if this is the correct way then which is to be come first , checking of null and then actual parameter checking or there are any other good statements alternatives for this .
Please suggest
这篇关于使用null或默认值检查if else替代If else的最佳方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!