Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Converting VFP date type to SQL SmallDateTime
Message
 
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
01038556
Message ID:
01038732
Views:
26
>
>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform