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

Click here to load this message in the networking platform