Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
The best way to use a portion of a field for indexing
Message
De
10/01/2005 16:16:48
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
10/01/2005 16:06:01
Steven Dyke
Safran Seats USA
Texas, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
00975802
Message ID:
00975811
Vues:
21
>I have a uniqueindex made like FAI2005-000001. It is based on the year the record was input. When a new record is added I need the last unique id plus 1. My SQL statement I use is:
>
>Select faiuniqueid From fai_required Where Val(SubStr(faiuniqueid,4,4)) = Year(Date()) InTo Cursor myFAIlist
>
>This sql statement runs very slow on our older computers. Is there a way to do this different to make it faster?

Steven,
I assume your index expression is directly the field name (ie: value stored in index is directly FAI2005-000001).

Select faiuniqueid From fai_required Where faiuniqueid = 'FAI'+padl(year(date()),4) InTo Cursor myFAIlist

Should make it faster. Or even you don't need a select to get max. Set order to desc, seek to that value.

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform