Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sys(3) and sys(2015)
Message
De
10/11/2011 14:04:44
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01528576
Message ID:
01528587
Vues:
57
>Hi everybody,
>
>I see that we're using sys(3) in one place which may return non-unique numbers. Does sys(2015) have the same problem?
>
>Say, I see this comment in Help
>
>Remarks
>Use SYS(2015) to create unique names for items such as procedures, functions, files, tables or cursors. You can add a prefix or change the length of the name using the SUBSTR( ) function. For example, the code "tmp"+SUBSTR(SYS(2015),4,3) returns tmpCIOS.
>
>The name that SYS(2015) returns is created from the system date and system time. Calling SYS(2015) more than once during the same millisecond interval returns a unique character string.
>
>So, can I 100% trust sys(2015)?
>
>Thanks in advance.

We use SYS(2015) and I can't recall ever having a problem with it. For example
SELECT SYS(2015) AS uid,* FROM sometable INTO CURSOR somecursor


SELECT SPACE(10) AS uid,* FROM sometable INTO CURSOR somecursor
REPLACE ALL uid WITH SYS(2015)
In both cases
SELECT COUNT(DISTINCT uid) FROM somecursor
shows RECCOUNT('somecursor') regardless of how many records were created
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform