Page 1 of 1

A easy way, to do incremental seek on numeric fields ?

Posted: Fri Apr 11, 2008 10:46 am
by ukoenig
Hello,

In a old program of mine, there is a index on
numeric Customer-Numbers ( CDX ).

The index is => Index on STR(number)
index on LTRIM(STR(number)) doesn't work.

When you do a seek on this field ( N 5 0 )
as a sample you seek < 5 > you have to do - - - - 5
4 blanks + "5"

Must i write a function for this ?

Regards

Uwe :lol:

Re: A easy way, to do incremental seek on numeric fields ?

Posted: Fri Apr 11, 2008 10:51 am
by Richard Chidiak
Uwe

Index on numeric work fine

index on number to ....

and then seek 5 or whatever else

no problem with it, i have many numeric indexs in my app

Richard

Posted: Fri Apr 11, 2008 10:53 am
by Detlef Hoefner
Uwe,
index on LTRIM(STR(number)) doesn't work.
this is normal because all index keys need to be of constant same length.

Moreover it's a bad design to use numeric fields for indexing.
They are better used for numeric operation / calculation.

If you can't avoid it i'd take 'strzero( nVal, nLen, nDec )' for indexing and searching.

Regards,
Detlef

Seek on numeric fields

Posted: Fri Apr 11, 2008 11:01 am
by ukoenig
Detlef Thank you,

Yes it is a very old application and
to much work to change it.

I will try Strzero

Regards

Uwe :lol: