Skip to main content
2 of 2
added 40 characters in body
Peter
  • 2.5k
  • 2
  • 5
  • 20

Execution plan - Not using Index seek due to ISNULL

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)

the ISNULL is causing me problems with using the index how can i avoid using this format of ISNULL?

p.PlatformId = ISNULL(@PlatformAccountId, p.PlatformId)

this format is causing the execution plan to do index scan.

dexon
  • 47
  • 5