Milliseconds precision

L

Lourenço Teodoro

I need to store and retrieve data form an Access Database using millisecond
precision. Does anyone know the format that I should use in SQL INSERT and
SELECT commands to specify milliseconds?

Regards,
Lourenço.
 
A

Allen Browne

Use a Currency field to store your duration in seconds.

Currency is a fixed-point data type with 4 decimal places, so it has an
extra place available beyond what you need, and it store the fractions
precisely (which floating point numbers do not).
 
L

Lourenço Teodoro

Thank you for your help, but I do not think that I have to use an additional
field.

When I use Sybase for example, I can specify '2004-04-22 12:55:00.123' in a
SQL statement.

I know that access can store milliseconds, because I developed a simple
program that executes an SQL statement with ODBC and with SQLBindParameter
using the SQL_C_TYPE_TIMESTAMP and I was able to store and retrieve the
timestamp. There has to be a way to use the value in the statement directly
when working with ADO.NET.

I really appreciate if anyone could help me with this matter.

Lourenço.
 
D

Douglas J. Steele

Sorry, but the Access Date/Time datatype does not have millisecond
precision.

Date/times are stored as 8 byte floating point numbers, where the integer
part represents the date as the number of days relative to 30 Dec, 1899, and
the decimal part represents the time as a fraction of a day.

As I type this, it's 15:02 EDT, so Now() returns
2004/04/22 15:02:08 = 38099.6264814815

I do not believe floating point accuracy is sufficient that .6264814815 can
be assumed to represent milliseconds.
 
Top