Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Building an SQL string
Message
De
20/11/2001 16:28:48
 
 
À
20/11/2001 14:54:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00584086
Message ID:
00584207
Vues:
26
>>I may be missing the point entirely but how about
>>
>>
>>lcSQL = 'UPDATE ' + cMyTable + ' SET ' + cMyDateField + ' = dSomeDate '   + 'WHERE ' + MyKeyField + ' = ' + uKeyField
>>
>>>Hi All,
>>>
>>>I'm buiding an SQL string to execute as a macro or an EVALUATE(). Every data type I've tested thus far works except for DATE.
>>>
>>>lcSQL = 'UPDATE ' + cMyTable + ' SET ' + cMyDateField + ' = ' + dSomeDate + 'WHERE ' + MyKeyField + ' = ' + uKeyField
>>>
>>>&lcSQL
>>>
>>>Converting dSomeDate to a Character causes a data mismatch error.
>>>
>>>Any ideas on how to accomplish this?
>>>
>>>TIA
>>>Robert
>>>
>>>
>
>Rich
>
>If the variable is in scope, that will work fine...
>
>But, not converting it will limit the locations in the application in which the string can be macro substituted and executed.
>
> Jay

In code snippet provided the macro expansion takes place right after building the string so everything should be in scope. But you're right. If, for example, the SQL string was being returned from a function before expansion, the variable could go out of scope. Thanks for the heads up.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform