Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data type mismatch
Message
 
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00935887
Message ID:
00935920
Views:
21
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.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform