SDAC SQL2008 DateTime2

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
jpg
Posts: 4
Joined: Tue 02 Nov 2010 16:32

SDAC SQL2008 DateTime2

Post by jpg » Tue 18 Jan 2011 08:54

Hi,
Using RemObjects/SDAC to insert some data into a SQL2008 system (64bit), I’m occasionally seeing the message,
Operand type clash: datetime2 is incompatible with int(#0)
When one of the parameters is a DateTime field.

Any ideas?

AndreyZ

Post by AndreyZ » Wed 19 Jan 2011 10:01

Hello,

The point is that in SQL Server 2008 implicit add for the datetime2 type was disabled because of its increased precision. Therefore the SQL code like

Code: Select all

select sysdatetime() + 1
will cause the "Operand type clash: datetime2 is incompatible with int" server error. You can read more about it here: http://sqlblog.com/blogs/aaron_bertrand ... eries.aspx

jpg
Posts: 4
Joined: Tue 02 Nov 2010 16:32

Post by jpg » Wed 19 Jan 2011 10:44

If I give you an example:

UPDATE myTable SET myDateField = :MyDateParameter


using this in RemObjects with SDAC creates you a parameter of
MyDateParameter and by default set to type Unknown

When you come to use this update statement, the code sets the date input parameter and executes the update statement.

I have no control over the field type used as its managed by (far as I can see) by SDAC

jpg
Posts: 4
Joined: Tue 02 Nov 2010 16:32

Post by jpg » Wed 19 Jan 2011 11:01

Also noticing it only seems to happen on a 64bit machine

AndreyZ

Post by AndreyZ » Thu 20 Jan 2011 15:05

I cannot reproduce the problem. Please try composing a small sample to demonstrate the problem and send it to andreyz*devart*com.

Post Reply