timestamp char conversion 
Author Message
 timestamp char conversion

Does anyone know how to convert a timestamp into a character string.
I've tried convert(char(16),timestamp) with no luck.

Thanks Bruce



Fri, 10 Dec 1999 03:00:00 GMT
 timestamp char conversion

Quote:

> Does anyone know how to convert a timestamp into a character string.
> I've tried convert(char(16),timestamp) with no luck.

The term "timestamp" as used in Sybase is really something of a
misnomer!  It has nothing, zilch, nada, zippo to do with wall clock
time.  It is really just a binary version number, which has no meaning
whatever.  Sybase simply guarantees that whenever any field in a row
changes, so will the timestamp value.  The purpose of this is for the
case where you display a row for a user to edit and you don't want to
lock the page while the user is editing the data.  The problem solved
by a timestamp in such a case is, what if another user happens to make
changes to that row while the first user is still editing it -- what
is known as the "conflicting updates" situation.

With a timestamp, what your application does when the user clicks the
"OK, save my changes" button, it opens a transaction, checks whether
the timestamp has changed since the user downloaded a copy of the
record for editing, then does the update and commits the transaction
only if the timestamp is the same.  If the timestamp has changed, then
your application needs to abort the transaction and give the user a
suitable error message explaining that somebody else has edited the
same record, and so forth.

Timestamps are also needed when updating big TEXT/BINARY fields that
are too big for one INSERT statement and must be handled with multiple
WRITETEXT commands in chunks.  You need to make sure that before you
write each chunk you check that the timestamp is still the same, so
that your WRITETEXT does not muck-up changes somebody else may have
just made...

All this is explained in much detail in the Sybase manuals.  The point
is, checking for updates since a copy was downloaded is really the
ONLY thing you can do with timestamps; they cannot be converted to
anything meaningful because they do not contain such information.

If you want a "timestamp" that has meaning in terms of wall clock time,
you must have a DATETIME field with a name like Submission_Date, and use
a trigger on the table to maintain it whenever a record is inserted or
updated.

Hope this helps.
---------
As of 20 Jun 1997, 924 days till Y2K....

http://paella.med.yale.edu/~healy
Why do people who know the least know it the loudest?



Mon, 13 Dec 1999 03:00:00 GMT
 timestamp char conversion

Quote:

> Does anyone know how to convert a timestamp into a character string.
> I've tried convert(char(16),timestamp) with no luck.

> Thanks Bruce

Bruce,

If you're interested in *exactly* what you asked for (and not to convert
it
into a date/time value) then check out my signature...

The first line converts it into a character string. The second line
converts
it back into varbinary.

If you want to convert it to a date, you're out of luck.

Bob Munson
--

Update... Where tsequal(timestamp,convert(varbinary(8),convert(money,



Thu, 16 Dec 1999 03:00:00 GMT
 
 [ 4 post ] 

 Relevant Pages 

1. Timestamp to char conversion...

2. timestamp use ; timestamp conversions

3. how can I conver char to TimeStamp

4. SQLServer & VB 32bit TimeStamp Conversion Problem

5. timestamp (rowversion) string conversion

6. Timestamp conversion to other usable data type

7. timestamp conversion

8. Varchar to timestamp conversion

9. UNIX Timestamps Conversions

10. Timestamp data type conversion

11. Varchar to timestamp conversion

12. Timestamp conversion?


 
Powered by phpBB® Forum Software