Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select from SPT - Into Array?
Message
 
 
À
28/08/2009 11:02:04
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 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01421480
Message ID:
01421485
Vues:
45
>On regular dbf tables, I will sometimes do this in a method:
>
>
>Select sum(qty*price) from JobItems Into Array laTotal
>
>return Nvl(laTotal, 0)
>
>
>Now that I am working on moving my data to SQL Server, I need to know how I can you make a SPT Sql call and have it pull something back into an array like the above?
>
>
>.

See this sample in Help
* Create temp stored procedure with OUTPUT parameter and call it.
   SQLEXEC(m.lnConn, "CREATE PROCEDURE #MyProc @outparam int OUTPUT AS;
      SELECT @outparam=100")
   SQLEXEC(m.lnConn, "exec #myProc ?@lnOutput")
   ? m.lnOutput
So, if you don't want to use the cursor, you can use output parameter to return your result. I think using one record cursor is fine and simple.

If you insist on using array, you would need to do COPY TO array after getting your cursor.
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform