Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Converting VFP date type to SQL SmallDateTime
Message
 
 
À
04/08/2005 17:00:53
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
01038556
Message ID:
01038732
Vues:
23
>
>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.
"The creative process is nothing but a series of crises." Isaac Bashevis Singer
"My experience is that as soon as people are old enough to know better, they don't know anything at all." Oscar Wilde
"If a nation values anything more than freedom, it will lose its freedom; and the irony of it is that if it is comfort or money that it values more, it will lose that too." W.Somerset Maugham
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform