Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
User Defined Functions in SQL
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00768999
Message ID:
00769311
Vues:
24
Try this. I know this example is redundant but it does what I think you described.

ljunkvar = .T. &&Or .f., it doesn't matter, but needs to be set first before the select statement.
SELECT junk(myyear) leaper, IIF(!EMPTY(m.ljunkvar), 'Yes', 'No ') leaper2 FROM table1 nowa
FUNCTION junk(tnyear)
IF TYPE('ljunkvar') != 'U'
RELEASE ljunkvar
PUBLIC ljunkvar
ENDIF
ljunkvar = MONTH(DATE(tnYear,2,28) + 1 ) = 2 &&Calculation to test for leap year. Returns a logical value.
RETURN ljunkvar

table1 contains only a single integer column with five records containing the 4-digit years of 1999 thru 2003.

>Hi All,
>
>I have a value that I am calculating with a UDF in a SQL statement in VFP 7. I want to use that same value, in the same statement, after it is calculated, however, it only seems to work if I create a second statement, that picks up the value.
>
>This would not be a big deal, except that there are about 4 layers of these dependant variables, so I end up execute 5 statements, when I would really like to do it in one.
>
>Any Ideas on How I can accomplish this in a single statment?
>
>Thanks.
>
>Daniel
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform