Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ODBC and empty date
Message
 
To
08/01/2008 14:25:19
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01280300
Message ID:
01280302
Views:
20
>We're using a remote connection to a VFP database. When doing an INSERT with an empty date field I get a data mis-match error.
>? SQLPREPARE(myHandle, "insert into xyz (effect_dt) values (?m.datevar )")---> 1
>m.datevar=DATE()
>? SQLEXEC(myHandle) ----> 1
>m.datevar={}
>? SQLEXEC(myHandle) ----> -1
>=AERROR(laError)
>? laError[2] ----> "Connectivity error: [Microsoft][ODBC Visual FoxPro Driver]Data type mismatch"
>A straight SQL Insert
>INSERT INTO xyz (effect_dt) VALUES ( {} )
works just fine.
>
>Any insight will be greatly appreciated.
>
>TIA to all.........Rich

There is NO such thing like EMPTY DateTime field in SQL Server.
That is why the only Fields I allow NULLs in them are datetime one.
If you insert an "EMPTY" datetime when you get data back you will see that you will get a perfectly valid date 01.01.1900.
SQL Server keeps DateTime as numeric valud that shows you how many seconds you should add to 01.01.1900 to get the value of the field.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform