>>
>>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)