>How can I read a SQL Server timestamp field in VFP?
The timestamp data type in SQL Server is not a date time field. It is a unique binary number that while it uses the current date and time when created it does not actually contain the date and time. If I remember correctly, it is a 16 byte unique key that is updated every time a record is modified. I also believe that SQL Server guarantees it to be unique for all rows in all tables within a database. If you want a date time field use the datetime or small datetime data types.
Timestamps are useful in determining if a record has been edited. In order to determine if a record has been modified since you last read it (because there is no useful record locking strategy in SQL Server) Your WHERE Clause can include the timestamp field, ie:
Update ...fields WHERE primarykey = ... AND timestamp = ...previous timestamp. If the record has changed since you first read the timestamp, the update will fail. Otherwise, you would have to check each field in the where clause.
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement