datetime and datetime2 data types are incompatible with the add operator

Discussion of open issues, suggestions and bugs regarding usage of dbExpress drivers for SQL Server in Delphi and C++Builder
Post Reply
mgorga
Posts: 7
Joined: Fri 12 Jun 2015 10:08

datetime and datetime2 data types are incompatible with the add operator

Post by mgorga » Wed 20 Oct 2021 14:04

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

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

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

Post by Stellar » Sat 23 Oct 2021 05:53

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!

mgorga
Posts: 7
Joined: Fri 12 Jun 2015 10:08

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

Post by mgorga » Fri 19 Nov 2021 07:20

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

Stellar
Devart Team
Posts: 496
Joined: Tue 03 Oct 2017 11:00

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

Post by Stellar » Thu 03 Feb 2022 09:19

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,

Post Reply