Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Usability of date syntax in SQL
Message
De
10/04/2003 04:02:12
 
 
À
10/04/2003 00:50:49
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00775883
Message ID:
00775912
Vues:
13
Have you tried
ldDate = DATE()
lcSQL = "SELECT Numero FROM News WHERE StartDate=CTOD( '" + DTOC( ldDate) + "')"
Its clunky though - with the CTOD in the expression that will get evaluated.

We use Private variables to pass variables in our SQL expressions - something you probably don't want to do but...

eg.
PRIVATE pdDate
pdDate = DATE()
lcSQL = "SELECT Numero FROM News WHERE StartDate = ?pdDate"
...pass SQL expression
RELEASE pdDate
and then have code to evaluate the variables prefixed with the question mark.

again, it has its downsides with the variable being available in other methods and PRGs, but the lifetime of the variable is usually quite short - and if you have a standard naming convention for the Private vars then they shouldn't really clash with others.
regards

Ian
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform