Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Using a UDF in a SQL Select
Message
 
 
À
13/07/2000 16:04:39
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00392029
Message ID:
00392044
Vues:
10
>I want use a UDF to create a new variable in a SQL select statement to crate a cursor for a
> report. The UDF would also be used to update a table using SCAN/ENDSCAN latter on.
>Calculation depends on 4 fields. I tried something like
>
> SELECT a,b,c,d,e,f,udf() as name from table
>
>to test it. Only one value is return (one calculated for first record). Do I have to pass
>all the fields to the UDF and use local variables? Did look at documentation, It is not
>clear on how to do this.
>
>TIA.

Claude,
You probably do.

SQL Select open the tables specified in the FROM clause again in new workareas under new aliases. It does this to have free rein in determining what indexes should be used. There is also the benefit that it doesn't move the record pointer in the original alias.

If you are using the original alias in your UDF then that is the problem. Pass in the field values and use those parameters to determine a return a value.

HTH.
Larry Miller
MCSD
LWMiller3@verizon.net

Accumulate learning by study, understand what you learn by questioning. -- Mingjiao
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform