Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
The best way to use a portion of a field for indexing
Message
From
02/02/2005 14:12:10
 
 
To
02/02/2005 10:45:47
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00975802
Message ID:
00983170
Views:
27
Hi Steven,

if your first select statement does not work, but your second ALWAYS works, the reason must be that LEN(emp1no)#LEN(employeenumber), or LEN(jobno)#LEN(JobNumber). Find out which length does not match, and use the PADR() function.
Select * From ntimetbl Where emp1no+DTOC(wend)+PADR(jobno,10) == checkthisentry InTo Cursor myVerifySingle
OR
Select * From ntimetbl Where PADR(emp1no,10)+DTOC(wend)+jobno == checkthisentry InTo Cursor myVerifySingle
OR
Select * From ntimetbl Where PADR(emp1no,10)+DTOC(wend)+PADR(jobno,10) == checkthisentry InTo Cursor myVerifySingle
You need to replace 10 with the actual field length.


if your first select statement does not work, but your second ALWAYS works, I can conclude that LEN(ALLTRIM(emp1no)) is constant. This is because

>I am hung up on an index again and need some help with this post you made to me about AllTrim in an index.
>
>My Index is set on employeenumber+DTOC(weekDate)+JobNumber.
>
>The data in this fields is variable length.
>
>My Select statement is
>
>Select * From ntimetbl Where emp1no+DTOC(wend)+jobno == checkthisentry InTo Cursor myVerifySingle
>
>This will not work unless I use
>Select * From ntimetbl Where AllT(emp1no)+DTOC(wend)+AllT(jobno) == checkthisentry InTo Cursor myVerifySingle
>
>Which I am not sure takes advantage of the index.
>
>Please help me to understand.
Previous
Reply
Map
View

Click here to load this message in the networking platform