Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query error using DTOC()
Message
De
24/01/2002 09:14:30
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
23/01/2002 19:35:21
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00609459
Message ID:
00609676
Vues:
12
>SELECT * FROM schedule WHERE DTOC(beg_date) > '01/01/2001'.
>This is giving me all the records from the table (25226)
>
>SELECT * FROM schedule WHERE YEAR(beg_date) > 2001
>This is giving me the correct number of records (2080)
>
>Both are valid queries. Correct ?
>What did I do to make the DTOC query not work anymore ?
>Am I going crazy ?
>
>Thanks, Ken

A string comparison is done. This only produces useful results if the string has the format year-month-date. The following string comparison should work:


DTOS(beg_date) >= "20010101"


However, it is simpler to compare as dates, not as strings.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform