Question:
I have a table in a Sybase database (version 10.x or 11.x) that has a datetime field. I was able to use/edit data in this table until I applied a patch to my Sybase client (versions affected below). Now after applying the patch, whenever I attempt to update records that were written to the table with the unpatched client I get the error "record has been modified by another user". What is wrong?
Answer:
As of Open Client Version 11.1.1, CT-Lib now uses a small datetime as its default. (A small datetime keeps year, month, day, hour & minute). This means that the 11.1.1 client will not even attempt to send second and millisecond data to the server when you post a record. If the data was written with second and millisecond precision, there is no way of reselecting it using Open Client 11.11.1. (for example 11:30:23.111 doesn't equal 11:30:00.000) In versions eariler than this (for example 11.1.0) CT-Lib used long datetime as its default. (A long datetime keeps everything a small datetime does plus seconds and milliseconds). As a result, when you upgrade your Sybase client you will see this problem.
One possible workaround is to change your Update Mode to be WhereKeyOnly or WhereChanged, but if the datetime field is part of the key or you change the value of the datetime field you will still see this problem. You could also use small datetime fields when you are designing your tables and avoid this problem entirely. If you have a database which requires second and/or millisecond precision for the datetime fields, you have a few options:
1. Use Open Client 11.1.0 or 10.0.4 with CT-Lib
2. Use Open Client 11.1.1 with DB-Lib
3. Write your own implementation of second and millisecond times in another field and use it in conjunction with a short date.
If these alternatives are not acceptable to you, we encourage you to provide this feedback to Sybase Customer Service or your Sybase sales representative.
Versions Affected:
Open Client 11.5, 11.1.1, 11.1 with ebf7398 applied, 10 with ebf7438.