Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Usability of date syntax in SQL
Message
De
10/04/2003 08:27:07
 
 
À
10/04/2003 05:48:55
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
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:
00775961
Vues:
16
>
>lcSQL = 'SELECT Numero FROM News WHERE StartDate = {^'+;
> TRANSFORM(DTOC(ldDate,1),'@R 9999/99/99')+'}'
>
>
>But these conversions might get tedious to use. Instead I'd put parameters to a custom object and pass it as well. ie:
>
>LOCAL oParams, lcSQL
>oParams = CREATEOBJECT('Custom')
>oParams.AddProperty('p_StartDate', {^1999/01/01})
>oParams.AddProperty('p_EndDate', {^1999/10/22})
>oParams.AddProperty('p_Title', 'VFP')
>
>lcSQL = '* FROM News'+;
>' WHERE StartDate = toParams.p_StartDate'+;
>'    and EndDate = toParams.p_EndDate'+;
>'    and atc(toParams.p_Title,Title) > 0'
>RunSQL(lcSQL, oParams, 'myCursor')
>
>
>FUNCTION RunSQL
>LPARAMETERS tcSQL, toParams, tcOutCursor
>Select &tcSQL into cursor (tcOutCursor)
>
Cetin

Thanks, but I guess, I'll continue to use the DateUniversal() function I built when I need to generate a static SQL syntax when having a date or datetime value in it.
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform