Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Data type mismatch
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00935887
Message ID:
00935920
Vues:
22
I see. You want to replace the month with its number:
The dates is 1 jan 03...


SELECT test1
scan
c3 = LEFT(ALLTRIM(CHRTRAN(examcode,"0123456789","")),3)
replace nmonth WITH Rep1(c3)

ENDSCAN

FUNCTION Rep1
PARAMETERS cMes
LOCAL cRes
cRes = 0
DO CASE
CASE UPPER(cMes) = "JAN" && No other digits here
cRes = 1
CASE UPPER(cMes) = "FEB"
cRes = 2
CASE UPPER(cMes) = "MAR"
cRes = 3

CASE UPPER(cMes) = "APR"
cRes = 4

&& ... other months go here

CASE UPPER(cMes) = "OCT"
cRes = 10

CASE UPPER(cMes) = "NOV"
cRes = 11

CASE UPPER(cMes) = "DEC"
cRes = 12

ENDCASE

RETURN cRes
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