Even if the column is indexed, it would be somewhat astonishing to use an index to satisfy a matching predicate like "string > '' " unless the vast majority of the rows have the empty string. NULL might work better for you, as in SQL Anywhere IS NULL is a sargable predicate.
Reimer is correct, length(string) <> 0, or alternatively length(string) > 0, is not a sargable predicate. The predicate string > '' is sargable. Also, the selectivity of length(string) > 0 will be a guess, while the selectivity of string > '' can be estimated by sampling the index.
answered 11 May '12, 14:14
IIRC a where clause containing a function is not sargable, so your other alternative looks better to me. But probably one the Sybase experts will elaborate on that.
answered 11 May '12, 11:39