SDAC does not fully support SQL 2008 datetime2

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Posts: 17
Joined: Fri 15 Aug 2008 18:09

SDAC does not fully support SQL 2008 datetime2

Post by Vladimir » Thu 03 Dec 2009 01:26

The SDAC Delphi DateTime is only accurate to a millisecond.
If a new datetime2(7) column is a part of a key, a record can't be deleted since the DateTime SDAC sends to SQL isn't accurate enough

Here is SDAC trying to delete my Notes record

exec sp_executesql N'DELETE FROM dbo.PurchaseOrderLineNotes
pohID = @P1 AND polLineNo = @P2 AND polntID = @P3 AND polnCreatedOn = @P4',N'@P1 int,
@P2 int,@P3 smallint,@P4 datetime2(7)',124,2,2,'2009-12-02 18:00:15.7430000'

And here is the CreatedOn from then record from the Management studio

2009-12-02 18:00:15.7430449

Please support SDAC being fully compliant with datetime2 data type.

Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Thu 03 Dec 2009 08:44

This behaviour is connected with the fact that Delphi TDateTime field keeps time only to millisecond, and we can't influence this behaviour.

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


Post by jpg » Tue 02 Nov 2010 16:37

So really there's no simple solution other than to explicitly state it's a datetime field or use cast/convert

Post Reply