Page 1 of 1

SDAC SQL2008 DateTime2

Posted: Tue 18 Jan 2011 08:54
by jpg
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?

Posted: Wed 19 Jan 2011 10:01
by AndreyZ
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

Posted: Wed 19 Jan 2011 10:44
by jpg
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

Posted: Wed 19 Jan 2011 11:01
by jpg
Also noticing it only seems to happen on a 64bit machine

Posted: Thu 20 Jan 2011 15:05
by AndreyZ
I cannot reproduce the problem. Please try composing a small sample to demonstrate the problem and send it to andreyz*devart*com.