Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select from SPT - Into Array?
Message
 
 
To
28/08/2009 11:02:04
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01421480
Message ID:
01421485
Views:
44
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform