Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Usability of date syntax in SQL
Message
From
10/04/2003 00:50:49
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Usability of date syntax in SQL
Miscellaneous
Thread ID:
00775883
Message ID:
00775883
Views:
43
On some occasions, I have the need to incorporate in my SQL the value of the numeric field as is. For example, if I have a lnYear value of 1999 and that I am building a lcSQL string, I would do as is:
lcSQL='SELECT Numero FROM News WHERE Year='+ALLTRIM(STR(lnYear))
&lcSQL
So, this allows me to pass lcSQL as a parameter and have it working in another method. Otherwise, if I would do:
lcSQL='SELECT Numero FROM News WHERE Year=lnYear
&lcSQL
I would need to have lnYear visible in the method.

My question is how can I achieve the same with a date? I want to be optimizable and if I use:
lcSQL='SELECT Numero FROM News WHERE StartDate=CTOD('01/01/1999')
&lcSQL
This won't be.
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Next
Reply
Map
View

Click here to load this message in the networking platform