문제

From msdn

Each database has a counter that is incremented for each insert or update operation that is performed on a table that contains a rowversion column within the database.

Also

To return the current rowversion value for a database, use @@DBTS.

I have a database ( believe me it has just one table and no timestamp / rowversion fields)

enter image description here

But When I run select @@DBTS , I get a result as if I had a rowversion column :

enter image description here

(p.s. - inserting / updating - doesn't update this value) .

  • What is this value ?

  • Why Do I have it without having rowversion column ?

도움이 되었습니까?

해결책

What is this value ?

It's the value of the counter in the database that is used to implement rowversion columns.

Why Do I have it without having rowversion column ?

The documentation you've quoted says that each database has such a counter. It then states that it will be incremented by operations against tables that contain rowversion columns.

It doesn't say that the existence of this counter depends on there being any such tables in your database.


Parse it out as:

A) Each database has a counter

B) that is incremented

C) for each insert or update operation that is performed

D) on a table

E) that contains a rowversion column

F) within the database.

(E) and (F) are conditions that apply to (D). (C) indicates what operations on (D) cause (B) to occur. None of (B-F) affect the truth or otherwise of (A).


There's also no documentation (that I can find) that indicates that it should start at 0x0000000000000000 or any other value. Given that the only purpose of this column is to allow ordering to be determined (X happened after Y or before Y), it shouldn't matter what the actual values returned are.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top