Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to create a STOD command/function?
Message
De
03/05/2002 10:53:12
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
01/05/2002 11:58:26
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00651378
Message ID:
00652409
Vues:
19
>Hi all,
>
>I have a character field that is a date in mmddyyyy format. I need to sort the file by this serv_date field.
>
>There is a DTOS (Date To String) command, but no inverse STOD (String To Date). Currently I am using:
*)******************************************************************************
>*) we change serv_date from looking like
>*) "06251998" to look like "06/25/1998"
>*)------------------------------------------------------------------------------
>m.serv_date = SUBSTR(serv_date,1,2) + "/" + SUBSTR(serv_date,3,2) + ;
>"/" + SUBSTR(serv_date,5,4)
Then I use CTOD(m.serv_date). Since the table is over 5.5Meg records, this takes a while using a SEEK inside of a scan. What is frequently requested is that I create a new table based on serv_date from a particular date to a particular date. Then create a "KILL" table with serv_date between the last particular date till DATE(). The table crosses the Y2K boundary, so that is also a challenge, especially in FPW2.6. I have thought about changing the field to a date format, but that would mean changing numerous programs across several projects. If there's no other way, then that's the way I'll go.
>
>Does anybody know of a faster/better way to do this? Maybe something in SQL? I'm not smart enough to figure it out.
>Help!!
>
>TIA
>Pete

Pete,
Wouldn't actually only first time creation of an index take time. Create and index :
index on right(myDateStr,4)+left(myDateStr,4) tag myDateSort

*Scan
set key to range dtos(DateStart), dtos(dateEnd)
scan
...
endscan

Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform