>You used to be able to index on a UDF, but I don't know for certain that you still can. If so, have it return the value as the field's actual value, unless it's zero. If zero, then it returns one more than the maximum value the field can hold.
>
>I had a scenario where I was able to build an index on a UDF. However, in the final analysis, I rejected the idea because it hindered performance, and created more code to maintain. Perhaps a filtered index might suffice.
Thanks, George, but as you likely saw by now Edward came up with several good solutions using the IIF(), similar to your idea above...
The Anonymous Bureaucrat,
and frankly, quite content not to be
a member of either major US political party.