timestamp purpose and use if it

M

mesut

Hi there,

I'm using a creationDate and ModifiedDate in all my tables with
Datatype: DateTime.
In most of my tables I need to do update/delete.

Do I also need to add a field with data type timestamp in my CRUD
tables ?
Why do I need timestamp field ?
how to use it I mean is it just define the timestamp field in those
tables? how does that work then?

thanks mesut
 
M

Marc Gravell

The timestamp data type has special rules: you can't update it
yourself, and it always gets updated with any row update. As such, it
is a very quick way of testing a row for changes, since it is
impossible to update the row without updating the timestamp. In
reality, it is just a database-wide counter... every row update
increments the counter etc.

You don't *need* a timestamp, but it can be very useful in a lot of
scenarios. Many ORM tools will recognise timestamps and make
appropriate concurrency checks (rather than checking every column for
updates).

Marc
 
M

mesut

The timestamp data type has special rules: you can't update it
yourself, and it always gets updated with any row update. As such, it
is a very quick way of testing a row for changes, since it is
impossible to update the row without updating the timestamp. In
reality, it is just a database-wide counter... every row update
increments the counter etc.

You don't *need* a timestamp, but it can be very useful in a lot of
scenarios. Many ORM tools will recognise timestamps and make
appropriate concurrency checks (rather than checking every column for
updates).

Marc

Hi Marc,

thanks for the info.. So if I understand well it's useful for the
concurrency checking. Any simple sample you can provide? at least can
you give the keywords to google?

thanks again,
mesut
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top