Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What is more efficient of the two
Message
From
12/07/2006 08:14:29
Dorin Vasilescu
ALL Trans Romania
Arad, Romania
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
Database:
MS SQL Server
Miscellaneous
Thread ID:
01135592
Message ID:
01135638
Views:
11
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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform