Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQLEXEC - INSERT INTO syntax question
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00599449
Message ID:
00599478
Vues:
28
Hi Larry,

Thanks for your suggestion. I'll look into what you've suggested.

Al

>Al,
>It's not. < s >
>
>The SQL Server ODBC driver has a property called AutoTranslate. This proeprty determines if SQL Server will translate character expressions into the appropriate data type if they don't match. For example, if the field in question is a date and the character string passed in matches the date format then it will be translated. The default for this property is Yes (things will be translated). However, if this is set to No in the ODBC entry or the connection string then your code will fail.
>
>A better approach, IMO, is to use the T-SQL function CONVERT() to explicitly convert your character string to the required date type. Ex.
>set textmerge on
>text to strSQL noshow
>   Insert into tblTest(cText1, cText2, nNumber1, tDatetime1) Values(
>      '<< lcText >>','<< lcText1 >>',<< lnNumber >>,
>      convert(datetime,'<< year(ltdt) >>/<< month(ltdt) >>/<< day(ltdt) >> << hour(ltdt) >>:<< minute(ltdt) >>:<< sec(ltdt) >>',120)
>endtext
(remove spaces before and after << >>)
>
>Style 120 equates to yyyy/mm/dd hh/mm/ss (24Hr clock).
>
>Also, in VFP 7, you can use the new TEXT TO Variable option. This makes programming SQL statements a lot easier because you don't have to worry about multiple delimiters ('"]) inside the string.
>
>HTH.
Al Williams

Anola MB, CANADA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform