Alex Rivera | Logout

How to update sql server timestamp column without changing record data

Asked 2010-01-29T21:37:19.123
11

I have an sql server table with a timestamp column. Is there a way to force the timestamp column to change without an actual update of the record?

The reason I am asking is because I want the record's timestamp to change when a record is inserted/updated/deleted in a child table.

Timestamp may not be the best way to go about doing this. If not, what should I do? I don't want to use datetime because I don't feel that's a good way of versioning. I don't want to use an integer, because I don't want to have to read the value to increment it.

Suggestions?

Edit
Report

1 Answer

1

Have you looked into using triggers? It seems a more natural fit for what you're after.

I worked on an application that had timestamps across the board once upon a time; exactly what we were supposed to do with them proved to be kind of elusive so we audited them out of the schema. You could read timestamp in to objects you create based off of the data and check to see if it's changed when you go to update and rollback if you see that the data's dirty, but that's a lot of boilerplate for not a lot of gain (at least in the domain I was working in).

answered 2010-01-29T21:46:41.080

Your Answer