Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select SQl data using arrays
Message
 
À
15/08/2009 06:55:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
01418215
Message ID:
01418220
Vues:
47
>>>Native data Senario.
>>>localcur
>>>select somefields from mytable where mytable.keyfield in (select keyfield from localcur)
>>>the above works fine with native VFP data.
>>>
>>>SQL data senario
>>>localcur
>>>*** the localcur can not be used in SQLEXEC, therefore i populate the data into an array:
>>>select keyfield from localcur into array myarray
>>>Is there an SQL syntax similar to:
>>>sqlexec(lhandle,[select somefields form mytable where myrable.keyfield in myarray)
>>>Please note: I would like to avoid the creation of a string with data from the array.
>>
>>Nope, you can't do that.
>>But you can create an SQL query that would return you the same results using only SQL Server tables.
>Hi Boris,
>What kind SQL query. SQL cannot see the cursor I created at runtime ?

No, it can't but you can just use the same query you make to get the local cursor.
Use the same tables, the same conditions.

i.e. If you get local cursor withtha command:
SELECT * FROM YourSQLTable WHERE Somefield = 12
Then you could use the same in your next query:
SELECT somefields form mytable where  myrable.keyfield in (SELECT KeyField FROM YourSQLTable WHERE Somefield = 12)
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform