Questions tagged [rowversion]

91 questions
6
votes
2 answers

SQL rowversion support by entity framework

My project uses EF (tested with version 4 using self-tracking template and with version 5 using default templates, all database-first) against SQL Server 2012. The database tables have each a rowversion (timestamp) column defined. Using EF in it…
user3058082
  • 203
  • 1
  • 2
  • 7
6
votes
2 answers

How to update a record without changing rowversion

If a table has a rowversion column in it and you make an update to that row, the value of the rowversion column increases. I know that this is by design and the purpose of rowversion columns, however is there any way to make it such that an update…
wnka
  • 212
  • 1
  • 5
  • 10
5
votes
2 answers

Is there a possible race condition in this UPDATE statement?

I'm writing a synchronizer software which will take all changes in one DB and synchronize them to another DB. To this end I've added in my table T two columns: alter table T add LastUpdate rowversion, LastSync binary(8) not null default 0 Now I can…
Vilx-
  • 104,512
  • 87
  • 279
  • 422
4
votes
4 answers

SQL Server: Clustering by timestamp; pros/cons

I have a table in SQL Server, where i want inserts to be added to the end of the table (as opposed to a clustering key that would cause them to be inserted in the middle). This means I want the table clustered by some column that will constantly…
Ian Boyd
  • 246,734
  • 253
  • 869
  • 1,219
4
votes
1 answer

Consequences of Indexing the rowversion/timestamp column on SQL Server

Related to my prior question about having a sequence without interim holes (a guarantee that the numbers that are visible to readers are always incrementing) enter link description here I'd like to ask if a solution I devised makes sense. I created…
Szymon Pobiega
  • 3,358
  • 17
  • 18
3
votes
1 answer

Timestamp vs Int column for row versioning in SQL Server

I want to apply data concurrency on some of tables in my SQL Server database. In order to achieve row versioning, I am thinking of adding an integer column named RowVersion, and increase the row value of the column when I update a row. There is an…
Fer
  • 1,962
  • 7
  • 29
  • 58
3
votes
2 answers

Disconnected LINQ Updates: rowversion vs. datetime with trigger?

We're using LINQ to SQL and WCF for a new middle tier, and we're using Data Transfer Objects for passing over the wire rather than using the actual LINQ classes. I'm going to be using one or the other of the methods outlined here - Linq Table…
Zann Anderson
  • 4,767
  • 9
  • 35
  • 56
3
votes
1 answer

READ_COMMITTED_SNAPSHOT not recognized by SQL Server 2005

We're running SQL Server 2005 Enterprise SP3, and I'm trying to enable Row Versioning on a new database running in sql server 2005 mode. Query (against master database): ALTER DATABASE pod-moodle SET READ_COMMITTED_SNAPSHOT ON Result: Msg 102,…
pauska
  • 133
  • 1
  • 7
3
votes
1 answer

When rowversion column is calculated on SQL Server

When column of rowversion type is calculated on SQL Server? Is it on transaction commit or before (along with row modification operation)? I'm asking, because it is very important to me whether committed transaction can actually result with lower…
3
votes
2 answers

rowVersion gets mapped to byte[8] in Entityframe work but when manually casting it's byte[18]

I am getting rowVersion from database as byte[8] var rowVersion= new MyContext().Employee.FirstOrDefault(x => x.Id).rowVersion; // suppose above the actual databse values is 0x0000000000038B8C var rowVersionToLong =…
3
votes
2 answers

How do I store a rowversion values in a table that already has a rowversion column?

I have a two tables (Users, DeletedUsers) and a trigger Users_Delete. When a user record is deleted I want to store the id and the last rowversion value (before it was deleted) in the DeletedUsers table. Because SQL does not allow multiple columns…
Gene C
  • 2,010
  • 26
  • 34
3
votes
2 answers

Row versioning for MySql

Is there a built-in row-versioning mechanism for MySQL? Something similar to the 'timestamp' column in MS SqlServer.
alwayslearning
  • 4,493
  • 6
  • 35
  • 47
3
votes
1 answer

ServiceStack Ormlite and RowVersion support

What is the easiest way to support sql server rowversion during update? I tried this: db.UpdateOnly(u, f => new { f.Name, f.Description, f.Modified, f.ModifiedBy }, f => f.Version == u.Version && f.Id == u.Id); but that fails miserably because it…
2
votes
1 answer

Entity framework update of row version in a predefined order

I am using C#, EF and SQL Server and have few tables with parent-child relationship. There are more than 2 but in this example I will use only 2 for simplicity. Table Book Id DateModified RowVersion Table Page Id BookId - this is foreign key to…
Paul
  • 1,879
  • 1
  • 23
  • 44
2
votes
0 answers

Who should update the concurrency token in EF Core?

Who should update the concurrency token in EF Core? I am learning the EF Core through the tutorials over here. And I come across the concept of the concurrency tokens. While it is clear that the row version`s value is updated by the database when…