Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Converting VFP date type to SQL SmallDateTime
Message
De
04/08/2005 17:07:57
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
01038556
Message ID:
01038733
Vues:
28
>>
>>Actually, if your field in SQL is a datetime type field, I'd do it this way:
>>
>>
lfdate = NULL   && note no quotation marks!
>>cSqlInsert = "insert into Company (	MYDATEFLD ) values " + ;
>>	"(?lfdate)"
>>
>>This should work if the lfdate contains a NULL value or a date value.
>
>But the problem was (the reason for the thread) is that some of my VFP date fields are empty. So I had to deal with them before inserting into SQL Server. That is, in the code above, if lfdate is empty, it would generate an error. So I had to check for empty fields and set the value to "NULL" in code.
m.lfdate = IIF(EMPTY(alias.lfdate),NULL,alias.lfdate)
Fred
Microsoft Visual FoxPro MVP

foxcentral.net
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform