Page 1 of 1

datetime and datetime2 data types are incompatible with the add operator

Posted: Wed 20 Oct 2021 14:04
by mgorga
Hello,
I am trying to execute a query that adds a datetime. The query is like this:
UPDATE MY_TABLE
SET SCHEDULEDATE = :MYDATETIME_PARAM + SCHEDULEDATE

The field SCHEDULEDATE and the param MYDATETIME_PARAM are datetime type. This query fails if I connect using direct mode with the error "datetime and datetime2 data types are incompatible with the add operator" but it is working if I connect using OleDB mode.

Moreover, I tested with dbexpsda40.dll version 7.2.4.0 and with this old version is working. I tested version 8.1.4.0 and version 9.0.1.0 and it fails. I tested compiling the code with 32 bits and 64 bits over Windows 10, with the same result. I am using Delphi XE7.

Best regards,
Mario

Re: datetime and datetime2 data types are incompatible with the add operator

Posted: Sat 23 Oct 2021 05:53
by Stellar
Hi Mario!

Thank you for contacting Devart and for your inquiry!

Please be informed that we have not found any problems with changing the datetime field in the database.
We used the latest dbExpress Driver for SQL Server 9.0.1 and Delphi XE7 for testing.
To investigate this behavior of our driver, please compose a small sample demonstrating the issue and send it to us, including database objects creating scripts.
You can send the sample using the contact form at our site: devart.com/company/contactform.html

Looking forward to your reply!

Re: datetime and datetime2 data types are incompatible with the add operator

Posted: Fri 19 Nov 2021 07:20
by mgorga
Hello,
I sent an example and you were able to reproduce the error few weeks ago. Do you have an estimation about when it will be solved?

Best regards,
Mario

Re: datetime and datetime2 data types are incompatible with the add operator

Posted: Thu 03 Feb 2022 09:19
by Stellar
Hi Mario,

We have fixed the issue, and the fix will be included in the next dbExpress Driver for SQL Server build.

Best regards,
Sergey,