SQL Server ROWVERSION定义不正确吗? [英] SQL server ROWVERSION definition is not accurate?

查看:221
本文介绍了SQL Server ROWVERSION定义不正确吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自 msdn

每个数据库都有一个计数器,该计数器针对每次插入或 在包含以下内容的表上执行的更新操作 数据库中的rowversion列.

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.

要返回数据库的当前rowversion值,请使用@@ DBTS.

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)

但是当我运行select @@ DBTS时,如果有一个rowversion列,则会得到的结果:

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

(附言-插入/更新-不会更新此值).

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

  • 这个值是多少?

  • What is this value ?

为什么没有rowversion列就拥有它?

Why Do I have it without having rowversion column ?

推荐答案

这个值是什么?

What is this value ?

它是数据库中用于实现rowversion列的计数器的值.

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

为什么我没有rowversion列就拥有它?

Why Do I have it without having rowversion column ?

您引用的文档说每个数据库都有一个计数器.它 then 表示将通过对包含rowversion列的表的操作来增加它.

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.

将其解析为:

A)每个数据库都有一个计数器

A) Each database has a counter

B)递增

C)进行的每个插入或更新操作

C) for each insert or update operation that is performed

D)在桌子上

E)包含一个rowversion列

E) that contains a rowversion column

F).

(E)和(F)是适用于(D)的条件. (C)表示对(D)进行的哪些操作导致(B​​)发生. (B-F)均不影响(A)的真实性.

(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).

也没有文档(我可以找到)来表明它应该以0x0000000000000000或任何其他值开头.鉴于此列的唯一目的是确定顺序(X发生在Y之后或Y之前),所以返回的实际值是什么都没关系.

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.

这篇关于SQL Server ROWVERSION定义不正确吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆