• hmmm, What is the difference?

    Speed?

    Your solution gives about a 30ms decrease in time taken.

    AND (I.ErrorID >= @ErrNumStart OR @ErrNumStart = 0) -- Slow option

    AND (CASE WHEN I.ErrorID >= @ErrNumStart OR @ErrNumStart Is Null THEN 1 ELSE 0 END) = 1 -- fast option.

    Why would there be a difference?

    Your option has more to evaluate. Does it?

    The code is currently script. Once done roughly I will create a SP out of it.

    Thanks! Once again you make me rewrite some code...

    This is what I am after, it's a slow proc I am trying to increase...

    Cheers,

    Crispin

    Why don't you try practicing random acts of intelligence and senseless acts of self-control?

    Cheers,CrispinI can't die, there are too many people who still have to meet me!It's not a bug, SQL just misunderstood me!