I do not want to use an integer because I do not want to read the value to increase it.
UPDATE Table SET IntColumn = IntColumn + 1
Although this technically requires reading, I do not see any problems with it.
You can always just upgrade to the same value:
UPDATE Table SET SomeColumn = SomeColumn
which will also run the rowversion update.
ADDITION: you can make a view with the maximum number of rows in child elements:
SELECT Parent.*, MaxChildRowVersion as ChildVersion FROM Parent JOIN ( SELECT ParentId, MAX(RowVersion) as MaxChildRowVersion FROM Child GROUP BY ParentId ) as Child ON Parent.ParentId = Child.ParentId
But no, you cannot directly update the rowversion column (although you can implement your own updatable using @@ DBTS, binary (8) and INSTEAD OF ... triggers)
Could you give examples of your last moment? That sounds promising.
No, actually it is not.;) It works too much when you can just update a single value or use a view. These are 2 easy options.
But to be complete, the binary (8) column with the default @@ DBTS (which returns the database version number) and the AFTER UPDATE trigger, which also updates the binary column for the new @@ DBTS, will give you a pseudo-noise type that You can update manually. This would not be faster or better than just updating some other column to the same value.
Mark brackett
source share