i've got a procedure that i want to improve that uses this where clause: 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)
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)
the ISNULLISNULL
is causing me problems with using the index
how can i avoid using this format of ISNULLISNULL
?
-> p.PlatformId = ISNULL(@PlatformAccountId,
p.PlatformId)
p.PlatformId = ISNULL(@PlatformAccountId, p.PlatformId)
this format is causing the execution plan to do index scan.