Hi,
in my database application I insert log data into ms sql-server database using ado protocol (ZeosLib 7.2.4 stable, Lazarus 1.8.4 Win 32 and Win64).
Log data contains a datetime timestamp. I encountered the problem, that the millisecond part of the timestamp data is lost at the insert. Only the datetime part down to seconds ist inserted.
Reading the documentation, I found a connection parameter DateTimeWriteFormat to be specified as TZConnection.property. But I could not find any information how to supply the format - it should be according to Delphi standard, but where find this specificaton?
I am also not sure if this parameter, if set correctly, will help to solve my problem.
Can anybody help here?
woec
datetime milliseconds with ado ms-sqlserver
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: datetime milliseconds with ado ms-sqlserver
Hello,
you can set DateTimeWriteFormat like this:
The format specification is the same specification that FormatDateTime uses.
I am not sure if that helps with ADO and MSSQL though because the SQL Server ADO driver should be able to use parameters.
Best regards,
Jan
you can set DateTimeWriteFormat like this:
Code: Select all
ZConnection.Properties.Add('DateTimeWriteFormat=YYYY-MM-DD HH:NN:SS.ZZZ')
I am not sure if that helps with ADO and MSSQL though because the SQL Server ADO driver should be able to use parameters.
Best regards,
Jan
Re: datetime milliseconds with ado ms-sqlserver
Thank you for the hint.
I tried it, but it does not solve the problem - no change in behavior.
The datetime value is already defined as ftDateTime Parameter type in the TZQuery properties.
Also, I tried different settings for size and precision for this parameter, but also no change.
woec
I tried it, but it does not solve the problem - no change in behavior.
The datetime value is already defined as ftDateTime Parameter type in the TZQuery properties.
Also, I tried different settings for size and precision for this parameter, but also no change.
woec
-
- Platinum Boarder
- Posts: 1956
- Joined: 17.01.2011, 14:17
Re: datetime milliseconds with ado ms-sqlserver
Hello,
which column type do you use in the database?
Best regards,
Jan
which column type do you use in the database?
Best regards,
Jan
Re: datetime milliseconds with ado ms-sqlserver
Hi,
I use the "datetime" datatype for this timestamp in the ms sql-server database.
woec
I use the "datetime" datatype for this timestamp in the ms sql-server database.
woec
- EgonHugeist
- Zeos Project Manager
- Posts: 1936
- Joined: 31.03.2011, 22:38
Re: datetime milliseconds with ado ms-sqlserver
please test datetime2
because SQLServer does some roundings using the datetime type
because SQLServer does some roundings using the datetime type
Best regards, Michael
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/
You want to help? http://zeoslib.sourceforge.net/viewtopic.php?f=4&t=3671
You found a (possible) bug? Use the new bugtracker dude! http://sourceforge.net/p/zeoslib/tickets/