A TIMESTAMP value is precise to six decimal places in SQL Anywhere. However, to maintain compatibility with other software,
which may truncate the TIMESTAMP value to three decimal places, you can set the truncate_timestamp_values option to On to
limit the number of decimal places SQL Anywhere stores. The default_timestamp_increment option determines the number of decimal
places to which the TIMESTAMP value is truncated.
For MobiLink synchronization, if you are going to set this option, it must be set before performing the first synchronization.
If the database server finds TIMESTAMP values with a higher resolution than that specified by the combination of truncate_timestamp_values
and default_timestamp_increment, an error is reported.
Unloading the database and then reloading it into a new database in which the truncate_timestamp_values and default_timestamp_increment
values have been set is usually the easiest solution to ensure that the proper TIMESTAMP values are used. However, depending
on the type of TIMESTAMP columns in your table, you can also do the following:
If the TIMESTAMP columns are defined with DEFAULT TIMESTAMP or DEFAULT UTC TIMESTAMP (so that the value is automatically updated
by the database server when the row is modified), you must delete all the rows in the table before the truncate_timestamp_values
option is changed. You can delete the rows using the DELETE or TRUNCATE TABLE statement.
If the TIMESTAMP column is defined with a value other than DEFAULT TIMESTAMP or DEFAULT UTC TIMESTAMP, you can execute an
UPDATE statement that casts the values to a string and then back to a TIMESTAMP. For example:
SET ts = CAST( DATEFORMAT( ts, 'yyyy/mm/dd hh:nn:ss.ss' )
AS TIMESTAMP );
This process may lose more precision than is necessary. The format string to use depends on the number of digits of precision
to be kept.