Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What is more efficient of the two
Message
De
12/07/2006 08:14:29
Dorin Vasilescu
ALL Trans Romania
Arad, Roumanie
 
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 8 SP1
Database:
MS SQL Server
Divers
Thread ID:
01135592
Message ID:
01135638
Vues:
12
This message has been marked as a message which has helped to the initial question of the thread.
>Hi Dorin
>
>Thanks for responding.
>
>>You can do another way
>
>I like the idea but will not creating "( primary keys )" list reach a length-of-string kind of limit?

You can limit the IN ( ) predicate to a number of keys
#define IN_KEYS    20
cSql = [SELECT ... FROM ... WHERE pk IN ( ]
iCount = 0 
SCAN
    iCount = iCount + 1
    cSql = cSql + transform( cursor.pk ) + [,]
    IF iCount = IN_KEYS
        remove the last [,]
        cSql = cSql + [ ) ]
        SQLEXEC()
        insert spt to result
        iCount = 0
        cSql = [SELECT ... FROM ... WHERE pk IN ( ]
   ENDIF
ENDSCAN  
for last keys < IN_KEYS, you should execute again after SCAN loop exit
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform