我有一个我想要改进的程序,它使用这个 where 子句:
WHERE p.PlatformId = ISNULL(@PlatformId, p.PlatformId)
and p.PayeeStsId = 1
and p.PlatformPayeeId = ISNULL(@platformPayeeId, p.PlatformPayeeId)
and pba.PayeeBankStsId=1
and a.Gcid = ISNULL(@Gcid, a.Gcid)
Run Code Online (Sandbox Code Playgroud)
这ISNULL给我使用索引带来了问题,我怎样才能避免使用这种格式ISNULL?
p.PlatformId = ISNULL(@PlatformAccountId, p.PlatformId)
Run Code Online (Sandbox Code Playgroud)
这种格式导致执行计划进行索引扫描。