Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query error using DTOC()
Message
From
24/01/2002 09:14:30
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
23/01/2002 19:35:21
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00609459
Message ID:
00609676
Views:
14
>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)
Previous
Reply
Map
View

Click here to load this message in the networking platform