我想显示一个具有多个条件的条件,但如果任何条件为空或没有任何值,则比如何在 where 子句中设置。例子:
where
SR.fk_Designation_ID = @pk_Designation_ID
and SR.fk_SeniorityCategory_ID = @pk_SeniorityCategory_ID
and SR.IsCurrent_Appointment = 1 and SR.fk_SeparationType_ID is null
order by Senority_Joining_For_Order,E.Date_Of_Birth
这里 if @pk_SeniorityCategory_ID
is null
than 我不想在子句中包含and SR.fk_SeniorityCategory_ID = @pk_SeniorityCategory_ID
条件。where